-
Notifications
You must be signed in to change notification settings - Fork 41
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
Fix WaitForNavigation
within the same document
#247
Conversation
Previously WaitForNavigation assumed that a LifecycleEvent would always be fired, but this is not the case for navigation within the same document (e.g. via anchor links or the History API), so in those cases the call would timeout after 30s. The fix simply checks if we received a new document, otherwise it skips waiting for the LifecycleEvent. Even if that wait didn't time out, it would've failed with a nil pointer panic accessing event.newDocument.request. Closes #226
One thing I'm not sure about is if waiting for navigation events within the same document should be done with a separate method call (e.g.
Ah, actually, they allow waiting for a specific URL, which from looking at the code we don't seem to do, even though we have |
Good to see that you solved the issue 🥳
I'm on the side of making it in another PR (with another issue beforehand). We might also stop waiting if:
I'm not sure whether we handle these gracefully? Besides, Playwright waits for the |
Agreed. I'll create the issue, and we can discuss what priority it should have.
I would expect those to be handled by cancelling
I'm not concerned with minor discrepancies like this. We don't have to follow their code exactly. That said, we do have |
I didn't bring it up for renaming the event :) I wondered whether we handle the protocol events correctly 🤔 It turned that those are not protocol events but PW internals. |
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.
LGTM 👏
Previously
WaitForNavigation
assumed that aLifecycleEvent
would always be fired, but this is not the case for navigation within the same document (e.g. via anchor links or the History API), so in those cases the call would timeout after 30s.The fix simply checks if we received a new document, otherwise it skips waiting for the
LifecycleEvent
. Even if that wait didn't time out, it would've failed with a nil pointer panic accessingevent.newDocument.request
.Closes #226