Puppeteer returns undefined for page.evaluate despite being resolved on devtools
问题 I have a simple code in which I expect to find the element that contains certain text as such await page.goto('https://www.reddit.com/r/koreanvariety/comments/hsdt4j/the_great_escape_season_3_e12_back_to_the/') await page.waitFor(2000); const findComment = await page.evaluate(() => { return Array.from(document.querySelectorAll('a')).find(el => el.textContent === 'sometext' ) }) console.log('findComment', findComment) And although the code above works on devtools it returns undefined in my