Open RPing opened 4 years ago
An inelegant approach is to use the undocumented configurations config.browser
or config.launcher
with a configured puppeteer browser with custom launch options to set the timeout.
For Example:
const puppeteer = require('puppeteer');
const timesnap = require('timesnap');
timesnap({
browser: puppeteer.launch({
timeout: 120000 // can use 0 to disable timeout
})
});
Note that this approach overrides any other set launch configurations, including those set by config.quiet
, config.logToStdErr
, config.headless
, config.executablePath
, and config.launchArguments
. If you are using those configuration options, see these lines if you need to reenable them.
Alternatively you can use config.launcher
to automatically use the previously set launch options:
const puppeteer = require('puppeteer');
const timesnap = require('timesnap');
timesnap({
launcher: function (launchOptions) {
return puppeteer.launch(Object.assign({}, launchOptions, {
timeout: 120000 // can use 0 to disable timeout
}));
}
});
Looking at this now, it looks like it would be beneficial to allow custom launch options (not to be confused with config.launchArguments
).
Hi, timesnap is really awesome!
Here is a problem that I encounter. I want to tune page load timeout (puppeteer navigation timeout defaults 30s), like page.setDefaultTimeout or page.setDefaultNavigationTimeout, so I put them into timecut preparePage. But it doesn't work.
It seems that page.goto is earlier than preparePage, any suggestion?