R
R
rockwell3232020-08-20 01:33:03
JavaScript
rockwell323, 2020-08-20 01:33:03

How to properly intercept a new puppeteer link?

(async () => {
   const browser = await puppeteer.launch({headless: false, devtools: true});
   const page = await browser.newPage();
   await page.goto('https://example.com');
   await page.setViewport({width: 1000, height: 1000});

   await page.click('#btn_confirm'); // происходит клик и переходит на новый сайт https://new_web_site.com
})();

How do I continue with the new link https://new_web_site.com ?
This didn't help
const newPromise = new Promise(x => browser.once('targetcreated', target => target.page())); //перехват новой ссылки

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question