title: Puppeteer iterating through elementHandles from page.$$ selector
body: <p>I'm building a scraper, however I'm stuck at iterating through the elementHandles.</p>
  
  <p>I need to get the list of row elements which I do successfully. After that for each row I need to capture tds text/innerHTML (unsure which is which). For now it would be great just to print them out in stdout. </p>
  
  <p>The error I'm getting is <code>UnhandledPromiseRejectionWarning: TypeError: tds.forEach is not a function</code>, which from my googling around tells me that tds is not an array.</p>
  
  <p>I am able to achieve this in python and selenium, but since I'm a javascript newbie, I anticipate I'm doing something very wrong. </p>
  
  <p>From my understanding <code>element.$$('td')</code> returns a Promise, but if I put await I get the <code>SyntaxError: await is only valid in async function</code></p>
  
  <pre><code>  const selectors = await page.$$('#transactionItems &gt; tbody &gt; tr');
    console.log(selectors.length); // outputs 31 which is the right number
    selectors.forEach( (element) =&gt; {
      let tds = element.$$('td');
      console.log(tds);
      tds.forEach( (element) =&gt; { 
        console.log(element.innerText)
      });
    });
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I have tried the following code which prints it successfully, but that's still not what I'd want.</p>
  
  <pre><code>const selectors = await page.$$('#transactionItems &gt; tbody &gt; tr ');
  console.log(selectors.length);
  for(let tr of selectors){
    const trText = await page.evaluate(el =&gt; el.innerHTML, tr);
    console.log(trText)
  }
  </code></pre>
  
  <p>it outputs the following:</p>
  
  <pre><code>&lt;td&gt; T737410C - &lt;a class="pointer" target="_blank" onclick="openAPRImageWindow(&amp;quot;T071835642571&amp;quot;,&amp;quot;112255603963&amp;quot;);"&gt;Image&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;02/05/2018 06:48:06&lt;/td&gt;
  &lt;td&gt;DRPA&lt;/td&gt;
  &lt;td&gt; 07W - CBB&lt;/td&gt;
  &lt;td&gt;OPEN&lt;/td&gt;
  &lt;td&gt;$5.00&lt;/td&gt;
  &lt;td&gt;$25.00&lt;/td&gt;
  &lt;td&gt;$0.00&lt;/td&gt;
  &lt;td&gt;$30.00&lt;/td&gt;
  </code></pre>
  
  <p>What I would ideally need the output to be is
  <code>['T737410C', '02/05/2018 06:48:06', 'OPEN', '5.00', '25.00']</code></p>