mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat: browser.waitForTarget (#3356)
This adds `browser.waitForTarget` and `browserContext.waitForTarget`. It also fixes a flaky test that was incorrectly expecting targets to appear instantly.
This commit is contained in:
committed by
Andrey Lushnikov
parent
07febb637c
commit
6ac66c3547
@@ -121,7 +121,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
||||
server.waitForRequest('/one-style.css')
|
||||
]);
|
||||
// Connect to the opened page.
|
||||
const target = context.targets().find(target => target.url().includes('one-style.html'));
|
||||
const target = await context.waitForTarget(target => target.url().includes('one-style.html'));
|
||||
const newPage = await target.page();
|
||||
// Issue a redirect.
|
||||
serverResponse.writeHead(302, { location: '/injectedstyle.css' });
|
||||
|
||||
Reference in New Issue
Block a user