puppeteer
Advanced tools
Comparing version 1.0.0-next.1515568144024 to 1.0.0-next.1515618391320
@@ -24,5 +24,6 @@ /** | ||
* @param {!Puppeteer.Frame} frame | ||
* @param {number} timeout | ||
* @param {!Object=} options | ||
*/ | ||
constructor(frameManager, frame, options = {}) { | ||
constructor(frameManager, frame, timeout, options = {}) { | ||
console.assert(options.networkIdleTimeout === undefined, 'ERROR: networkIdleTimeout option is no longer supported.'); | ||
@@ -45,3 +46,3 @@ console.assert(options.networkIdleInflight === undefined, 'ERROR: networkIdleInflight option is no longer supported.'); | ||
this._initialLoaderId = frame._loaderId; | ||
this._timeout = typeof options.timeout === 'number' ? options.timeout : 30000; | ||
this._timeout = timeout; | ||
this._eventListeners = [ | ||
@@ -48,0 +49,0 @@ helper.addEventListener(this._frameManager, FrameManager.Events.LifecycleEvent, this._checkLifecycleComplete.bind(this)), |
@@ -82,2 +82,3 @@ /** | ||
this._coverage = new Coverage(client); | ||
this._defaultNavigationTimeout = 30000; | ||
@@ -175,2 +176,9 @@ this._screenshotTaskQueue = screenshotTaskQueue; | ||
/** | ||
* @param {number} timeout | ||
*/ | ||
setDefaultNavigationTimeout(timeout) { | ||
this._defaultNavigationTimeout = timeout; | ||
} | ||
/** | ||
* @param {!Object} event | ||
@@ -476,3 +484,3 @@ */ | ||
*/ | ||
async goto(url, options) { | ||
async goto(url, options = {}) { | ||
const referrer = this._networkManager.extraHTTPHeaders()['referer']; | ||
@@ -486,3 +494,4 @@ | ||
const mainFrame = this._frameManager.mainFrame(); | ||
const watcher = new NavigatorWatcher(this._frameManager, mainFrame, options); | ||
const timeout = typeof options.timeout === 'number' ? options.timeout : this._defaultNavigationTimeout; | ||
const watcher = new NavigatorWatcher(this._frameManager, mainFrame, timeout, options); | ||
const navigationPromise = watcher.navigationPromise(); | ||
@@ -534,5 +543,6 @@ let error = await Promise.race([ | ||
*/ | ||
async waitForNavigation(options) { | ||
async waitForNavigation(options = {}) { | ||
const mainFrame = this._frameManager.mainFrame(); | ||
const watcher = new NavigatorWatcher(this._frameManager, mainFrame, options); | ||
const timeout = typeof options.timeout === 'number' ? options.timeout : this._defaultNavigationTimeout; | ||
const watcher = new NavigatorWatcher(this._frameManager, mainFrame, timeout, options); | ||
@@ -539,0 +549,0 @@ const responses = new Map(); |
{ | ||
"name": "puppeteer", | ||
"version": "1.0.0-next.1515568144024", | ||
"version": "1.0.0-next.1515618391320", | ||
"description": "A high-level API to control headless Chrome over the DevTools Protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
253627
6397