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
feat(api): implement Page.waitForNetworkIdle()
#5140
Conversation
Page.waitForNetworkIdle()
Page.waitForNetworkIdle()
which will wait for there to be no network requests in progress during the `idleTime` before resolving.
05ee7ba
to
db1b35b
Compare
any status on this? |
I'm also interested in this. Super useful feature when want to do some action after everything has finished loading. |
Just found this https://github.com/jtassin/pending-xhr-puppeteer looks exactly what's needed. |
I'm trying to implement something similar and also realise that sometimes the |
03a4ca1
to
d4b17bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tjenkinson Thanks for your contribution! Could you resolve the merge conflicts and verify if local urls might be working now? Happy to get this landed :)
@jschfflr I brought it back up to date, but it still passes locally with the remote urls but fails with the digit ones :/
I'll have a look if this is still the cause later |
Fixed it :) But I think there may be a memory leak/bug. Currently puppeteer/src/common/NetworkManager.ts Lines 423 to 434 in 8d1a697
puppeteer/src/common/NetworkManager.ts Line 111 in 8d1a697
I wonder if there should be a puppeteer/src/common/NetworkManager.ts Lines 414 to 421 in 8d1a697
? |
Thanks for updating the commit! |
No problem, it's nice to finally get this added :) Here's the ticket: #7560. I don't have permission to assign it to you. Also noticed you turned auto merge on, but it's not approved yet |
@tjenkinson I just saw this test flake on the mac bot: Could you take a look into why that happened and address the issue? Thanks! |
That's weird. I wonder if it lagged in a few places and it went over Opened #7564 to see if that helps |
Yeah I think the bots are not very powerful so timing might be problematic in some places. But it looks like the fix solved it :) |
Which will wait for there to be no network requests in progress during the
idleTime
before resolving.One case where this is useful is if you want to take a screenshot after adding a css class that results in more assets being downloaded (background images etc).
refs #3083
TODO
RequestFinished
/RequestFailed
events aren't fired, and the request isn't removed from_requestIdToRequest
, even though thefetch()
call resolves. Any idea why? Is this a chromium bug?