Skip to content

Commit 731d77f

Browse files
authored
Fix fullPage option (#116)
1 parent 48f11f7 commit 731d77f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,14 @@ const internalCaptureWebsiteCore = async (input, options, page, browser) => {
377377
if (screenshotOptions.fullPage) {
378378
// Get the height of the rendered page
379379
const bodyHandle = await page.$('body');
380-
const bodyBoundingHeight = await bodyHandle.boundingBox();
380+
const bodyBoundingBox = await bodyHandle.boundingBox();
381381
await bodyHandle.dispose();
382382

383383
// Scroll one viewport at a time, pausing to let content load
384384
const viewportHeight = viewportOptions.height;
385385
let viewportIncrement = 0;
386-
while (viewportIncrement + viewportHeight < bodyBoundingHeight) {
387-
const navigationPromise = page.waitForNavigation({waitUntil: 'networkidle0'});
386+
while (viewportIncrement + viewportHeight < bodyBoundingBox.height) {
387+
const navigationPromise = page.waitForNetworkIdle();
388388
/* eslint-disable no-await-in-loop */
389389
await page.evaluate(_viewportHeight => {
390390
/* eslint-disable no-undef */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"dependencies": {
4646
"@cliqz/adblocker-puppeteer": "^1.26.11",
4747
"file-url": "^4.0.0",
48-
"puppeteer": "^21.5.0",
48+
"puppeteer": "^21.9.0",
4949
"tough-cookie": "^4.1.3"
5050
},
5151
"devDependencies": {

0 commit comments

Comments
 (0)