-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REGRESSION]: context.pages() now works differently #2878
Comments
The old snippet from 1.0.1 happened to work accidentally, because sometimes Overall, Playwright does not guarantee that by the time Instead, we recommend the following way to capture popups from clicks: const [childWindowPage] = await Promise.all([
page.waitForEvent('popup'),
page.click('[name="Add new child window"]')
]);
// Wait for the child page to load before accessing the content.
await childWindowPage.waitForLoadState();
// Ready to use.
const title = await childWindowPage.title(); You can find even more samples in our documentation. |
I think even this code has race condition
Chances are low but that doesn't mean race condition cannot happen. Spurious event do occur time to time. |
Well, I assume that you expect a popup as a result of the click, so there must be at least one popup. If there could be multiple, I'd suggest to use |
@dgozman
works well, but I want to have an easy access to all pages of current context even if it those pages are loading. |
@MihailPertsev The actual change in 1.2.0 is that It would indeed be handy if
Hopefully, this explanation helps a bit. |
Now I get it. Thanks! |
Context:
-GOOD Playwright 1.0.1
-BAD Playwright 1.2.0
-Operating System: Windows 10
Code Snippet
Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally. For example:
Describe the bug
For some reason in current (1.2.0) version you must wait till page is loaded, before you can grab it and assign it to a variable via context.pages() method... This wasnt the case in 1.0.1 version.
The text was updated successfully, but these errors were encountered: