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(frame): introduce Frame.goto and Frame.waitForNavigation #3276
feat(frame): introduce Frame.goto and Frame.waitForNavigation #3276
Conversation
This patch introduces API to manage frame navigations. As a drive-by, the `response.frame()` method is added as a shortcut for `response.request().frame()`. Fixes puppeteer#2918.
docs/api.md
Outdated
|
||
> **NOTE** `frame.goto` either throw or return a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`. | ||
|
||
> **NOTE** Headless mode doesn't match any nodest navigating to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295). |
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.
Is nodest
a typo or some term?
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.
Fixed.
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.
Not a term :)
docs/api.md
Outdated
|
||
> **NOTE** `frame.goto` either throw or return a main resource response. The only exceptions are navigation to `about:blank` or navigation to the same URL with a different hash, which would succeed and return `null`. | ||
|
||
> **NOTE** Headless mode doesn't match any nodest navigating to a PDF document. See the [upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=761295). |
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.
Nodest?
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.
Fixed.
lib/FrameManager.js
Outdated
*/ | ||
_onFrameDetached(frame) { | ||
if (this._frame === frame) { | ||
this._terminationCallback.call(null, new Error('Navigating frame is detached')); |
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.
was detached.
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.
Done.
@@ -2499,6 +2526,29 @@ const selector = '.foo'; | |||
await page.waitForFunction(selector => !!document.querySelector(selector), {}, selector); | |||
``` | |||
|
|||
#### frame.waitForNavigation(options) |
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.
Can we mark the page methods as shortcuts?
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.
Done.
This patch introduces API to manage frame navigations.
As a drive-by, the
response.frame()
method is added as a shortcutfor
response.request().frame()
.Fixes #2918.