title: Why is puppeteer page.$$eval returning undefined
body: <p>I'm trying to create a helper function for my e2e tests using puppeteer to select an item from a select dropdown that was implemented using Material UI. For some reason, the dropdown item returns undefined. This is my function. </p>
  
  <pre><code>export const selectFromDropDown = async (page, selectElement, className, value) =&gt; {
    const dropdownInput = await page.waitForSelector(selectElement)
    await dropdownInput.click()
    await page.waitForSelector(`li.${className}`)
  
    const dropdownItem = await page.$$eval(`li.${className}`, (listItems, val) =&gt; listItems.find((item) =&gt; item.dataset.value === val), value)
    console.log(dropdownItem, '000000')
    dropdownItem.click()
  }
  </code></pre>
  
  <p>I have also done <code>const dropdownItem = await page.$$eval(`li.${className}`, (listItems, val) =&gt; listItems.find((item) =&gt; console.log('match: ', item.dataset.value === val) || item.dataset.value === val), value)</code>. It logs false for others and true for the list item that matches the value but the dropdownItem is still undefined. What am I doing wrong?</p>