Answer the question
In order to leave comments, you need to log in
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
})();
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 questionAsk a Question
731 491 924 answers to any question