When I execute the same querySelectorAll()
on the same page but in diff envs:
- Chrome Dev Tools
- Puppeteer on NodeJS
then I get different objects.
On Chrome Dev Tools I call:
var elems = document.querySelectorAll("#someId > tr > td")
then I get a NodeList object like here:
NodeList(4) [td.tcat, td.trow, td.trow, td.trow]
And it's OK.
On NodeJS with Puppeteer I call:
...
await page.goto("http://localhost:8080/")
const elems = await page.evaluate(() => {
return document.querySelectorAll("#someId > tr > td")
})
...
then I get a bad object with 4x empty objects inside, like this:
console.log(JSON.stringify(elems))
{"0":{},"1":{},"2":{},"3":{}}
Any idea what I did wrong?