-
-
Notifications
You must be signed in to change notification settings - Fork 33
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: Properly perform page readiness validation #356
Conversation
I've also removed the |
will test with real devices tonight |
Can we relax the interval of On a real device, I observed high frequent When I repeated opening Actually this PR improved fast case, but this pr slightly increased slow response or no response case than current master in my test. I'm not sure what exactly caused this slow behavior (my current guess is something JS handles in the Safari/WebInspector side, but I'm not sure of the root issue), but for now, relaxing the interval could improve the stability in this perspective. Below is one example of no response case with this PR.
(no customization. Just started a session with browserName safari.) |
I assume I need to take another approach for successful navigation detection, which is based on async listeners rther than the active polling. Maybe something similar to https://github.com/microsoft/playwright/blob/f605a5009b3c75746120a6ec6d940f62624af5ec/packages/playwright-core/src/client/frame.ts#L116 |
@KazuCocoa It looks like I've found a way to properly enable lifecycle events broadcast on all pages. |
Checking with a944dde. I'm reading code as well update: oh, maybe |
hm, once my previous comment case occurs, it looks like no longer web inspector responds responses while appium sends new commands |
looks like that. I have disabled the wait for response there |
It looks like this is not this PR itself, but let me leave note here. When I kept opening a page repeatedly, suddenly the Safari no longer loaded page properly. I leave the log with my comment in https://gist.github.com/KazuCocoa/63f221e31ee53b649cb296330eaf8b2f?permalink_comment_id=4898811#gistcomment-4898811 After this behavior, it looks like Web Inspector no longer respond. The same behavior occurs via WebInspecor (not via Appium) as well. So when I attached a page with Web Inspector and kept reloading the URL via the inspector, then the reload button no longer functioned. I mean the device's Safari no longer reloaded the page while the inspector tried to show some information. Once this circumstance occurred, the inspector no longer got the page source, etc, from Safari. Bad thing as us is that Safari still worked via UI directly, I mean by my hand's direct interaction works. So this is Web Inspector/Safari internal issue by Apple I guess To recover this situation, I needed to kill the safari process once and re-open the Safari. This is the same in appium session, so terminating the safari and activating it again, then I corrected the context, the same operation worked again. |
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.
This change itself looks good in my testing.
iOS 17 x Safari? has issue but it is maybe WebInspector/Safari related, not this change itself.
Hm, for the no function's case, what maybe we could do is instead of applying f1141a7 , if no response by browse against So the |
I've added a timeout there and a warning message. Does it make more sense to you? |
log.warn( | ||
`Could not enable console events on the page '${this.pageIdKey}' (app '${this.appIdKey}') ` + | ||
`within ${CONSOLE_ENABLEMENT_TIMEOUT_MS}ms. This might be an Inspector bug.` | ||
); |
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.
thorw err;
to return error to the client?
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.
lets try this one first. Maybe it would still respond later...
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.
I did more testing. There was no response for over 10 minutes on my env... and the only way to recover the situation was to restart the Safari process. So probably #359 might help.
Once this occurs, other commands such as driver.title
also go to the same no response condition. Potentially we may need to add timeout error for other places in the future...
Yes, thank you. It is more clear than failing to load page silently (and return no-error) |
## [11.0.0](v10.2.2...v11.0.0) (2024-02-14) ### ⚠ BREAKING CHANGES * Removed the pageUnload API * Removed the waitForFrameNavigated API * Removed the pageLoadVerifyHook argument from waitForDom and from navToUrl APIs ### Features * Properly perform page readiness validation ([#356](#356)) ([a2fbd5a](a2fbd5a))
🎉 This PR is included in version 11.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The previous implementation was always waiting for 500ms before checking the page readiness. This one applies a proper race condition, so the validation starts immediately and thus could finish faster if the page loads fast enough.