diff --git a/bin/paged b/bin/paged index cd81407f4037de78480e3e28ac6e447271b460a7..f72ad8d295ab91ada6b7d6971560b4239a0d33da 100755 --- a/bin/paged +++ b/bin/paged @@ -115,6 +115,7 @@ if (typeof input === "string") { allowedPaths: program.allowedPaths, allowedDomains: program.allowedDomains, additionalScripts: program.additionalScript, + timeout: program.timeout, }; if (program.forceTransparentBackground) { diff --git a/src/printer.js b/src/printer.js index 0036ff1d4e7b44d1c24f1d437aeb82fdb3ca77e8..948e478e18331c753e93a3ce232b039f66d0d6af 100644 --- a/src/printer.js +++ b/src/printer.js @@ -26,6 +26,7 @@ class Printer extends EventEmitter { this.ignoreHTTPSErrors = options.ignoreHTTPSErrors; this.browserWSEndpoint = options.browserEndpoint; this.overrideDefaultBackgroundColor = options.overrideDefaultBackgroundColor; + this.timeout = options.timeout; this.pages = []; } @@ -63,6 +64,9 @@ class Printer extends EventEmitter { } const page = await this.browser.newPage(); + if (this.timeout) { + page.setDefaultTimeout(this.timeout); + } if (this.overrideDefaultBackgroundColor) { page._client.send('Emulation.setDefaultBackgroundColorOverride', { color: this.overrideDefaultBackgroundColor });