title: Proper way to get XPath lists in Chrome Puppeteer
body: <p>I'm using Chrome Puppeteer to get at some content on a Web page. This content is a list of items in a pseudo-table. I'm using XPath to get this content.</p>
  
  <p>When I tested the Xpath expression [in Chrome with the the XPath Helper Extension] it displays the list of text, so I know the XPath expression is fine.</p>
  
  <p>However, I'm having issues trying to do this with Puppeteer. Below is the relevant code [I omitted the opening and closing puppeteer code]:</p>
  
  <pre><code>var xpath_expr_str = "//div[contains(@class,'listings')]/div[4]/p/a";
  var page_url_str = 'https://my-url';
  
  await page.goto(page_url_str);
  await page.waitForXPath(xpath_expr_str);
  
  var xpath_payload_arr = await page.$x(xpath_expr_str);
  var xpath_val_arr = await page.evaluate(function(payload_arr){
      var url_list_arr = [];
      for(var i = 0; i &lt; payload_arr.length; i++)
      {
          url_list_arr.push(payload_arr[i].textContent);
      }
      return url_list_arr;
  }, xpath_payload_arr);
  
  console.log(xpath_val_arr);
  </code></pre>
  
  <p>When I run this, I get the following error:</p>
  
  <p><code>UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
  </code></p>
  
  <p>I can't seem to get at the list. But, the thing is if I try to just get at a single item in the list, it works ok. For example, the following code works:</p>
  
  <pre><code>var xpath_val_str = await page.evaluate(function(payload_arr){
      return payload_arr.textContent;
  }, xpath_payload_arr[0]);
  console.log(xpath_val_str);
  </code></pre>
  
  <p>What's the proper way to manage XPath lists when working with Puppeteer?</p>