How to get text from a web page – document.getElementsByClassName

I’m trying to get some text from the website.

I tried this, but it doesn’t work, it gives me “undefined”

CurBrowser.GetMainFrame().ExecuteJavaScriptAsync("var elems1 = document.getElementsByClassName('some-text')");
            CurBrowser.GetMainFrame().ExecuteJavaScriptAsync("for(var i = 0; i < elems1.length; i++){var textt = elems1[i].innerText}");

and this is what I am trying to target

<p class="some-text">
        hello World


const elements = document.getElementsByClassName('some-text');

for (const element of elements) {
<p class="some-text">
  Text from paragraph 1

<p class="some-text">
  Text from paragraph 2