Puppeteer: Page.evaluate Not Working After Waitfornavigation, Debug Not Working Inside Page.evaluate For Document
I am able to navigate to a page using puppeteer but afterwards the page.evaluate is not returning any response. Further, I am unable to debug inside the page.evaluate either. I run
Solution 1:
Selecting a city does not cause the URL to change, which is what page.waitForNavigation()
waits for.
This resolves when the page navigates to a new URL or reloads.
It never happens, so your code does not continue.
You might be looking for page.waitForSelector()
instead:
// ...await page.select('#ctl00_ContentPlaceHolder1_ddl_District', '020');
await page.waitForSelector('tbody tr');
let beds = await page.evaluate(() => {
let dataRows = document.body.querySelectorAll('tbody tr');
return [...dataRows].map(row => row.querySelector('h5').textContent);
});
console.log(beds);
await browser.close();
Post a Comment for "Puppeteer: Page.evaluate Not Working After Waitfornavigation, Debug Not Working Inside Page.evaluate For Document"