mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat(frame): introduce Frame.goto and Frame.waitForNavigation (#3276)
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 #2918.
This commit is contained in:
@@ -576,8 +576,7 @@ class Page extends EventEmitter {
|
||||
* @return {!Promise<?Puppeteer.Response>}
|
||||
*/
|
||||
async goto(url, options = {}) {
|
||||
const mainFrame = this._frameManager.mainFrame();
|
||||
return await this._frameManager.navigateFrame(mainFrame, url, options);
|
||||
return await this._frameManager.mainFrame().goto(url, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -597,8 +596,7 @@ class Page extends EventEmitter {
|
||||
* @return {!Promise<?Puppeteer.Response>}
|
||||
*/
|
||||
async waitForNavigation(options = {}) {
|
||||
const mainFrame = this._frameManager.mainFrame();
|
||||
return await this._frameManager.waitForFrameNavigation(mainFrame, options);
|
||||
return await this._frameManager.mainFrame().waitForNavigation(options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user