I'm trying to access innerText of a list of 8 els (elements).
When I map over els and console.log(el) I see 8 elements neatly printed in my console of browser.
But when I console.log(el.innerText) I am getting just 3 or 4 texts printed out in my console.
I don't understand, what is happening here?
// wait for all cards to appear on page
await page.waitForSelector(".card.cardItem:nth-of-type(8)", { timeout: 0 });
await page.$$eval(".card.cardItem", (els) => {
els.map((el) => {
// logs out 8 elements (all have innerText on webpage).
console.log(el)
// logs out innerText of only 3 elements. Why?
console.log(el.innerText);
});
});
I got it to work with using textContent instead. I don't understand why, but it works. I will keep question open as I'm still curious why innerText doesn't work here so if someone knows feel free to explain to us.