lib/grover.rb in grover-0.5.4 vs lib/grover.rb in grover-0.5.5
- old
+ new
@@ -30,26 +30,29 @@
try {
browser = await puppeteer.launch(#{launch_params});
const page = await browser.newPage();
const cache = options.cache; delete options.cache;
- await page.setCacheEnabled(cache);
+ if (cache != undefined) {
+ await page.setCacheEnabled(cache);
+ }
let request_options = {};
const timeout = options.timeout; delete options.timeout;
- if (timeout) {
+ if (timeout != undefined) {
request_options.timeout = timeout;
}
+
if (url.match(/^http/i)) {
request_options.waitUntil = 'networkidle2';
await page.goto(url, request_options);
} else {
request_options.waitUntil = 'networkidle0';
await page.goto(`data:text/html,${url}`, request_options);
}
const emulateMedia = options.emulateMedia; delete options.emulateMedia;
- if (emulateMedia) {
+ if (emulateMedia != undefined) {
await page.emulateMedia(emulateMedia);
}
return await page.pdf(options);
} finally {