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:
Andrey Lushnikov
2018-09-20 11:31:19 -07:00
committed by GitHub
parent ad49f792a4
commit 5acf953104
8 changed files with 193 additions and 20 deletions

View File

@@ -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);
}
/**