Monday 24 August 2020

How to access the JavaScript code that is loaded dynamically on a web page, by using Puppeteer?

I'm trying to access an object that is loaded dynamically on the web page.https://i.stack.imgur.com/Gq7Bz.pngBut the problem is that I can't access that data through the window object, even though it's loaded on the page.https://i.stack.imgur.com/ZNhMQ.pngHere's a simple script I'm using.const browser = await puppeteer.launch(); const [page] = await browser.pages(); await page.goto(pageUrl, {waitUntil: 'networkidle2'}); let data = await page.evaluate(() => { let info = window._wq; return {info}; }); for(i in data){ console.log(i, data[i]) } await browser.close();

Submitted August 25, 2020 at 03:12AM by regression-analysis

No comments:

Post a Comment