Skip to content

Commit

Permalink
Fix fullPage option (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbfcd authored Jan 25, 2024
1 parent 48f11f7 commit 731d77f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,14 @@ const internalCaptureWebsiteCore = async (input, options, page, browser) => {
if (screenshotOptions.fullPage) {
// Get the height of the rendered page
const bodyHandle = await page.$('body');
const bodyBoundingHeight = await bodyHandle.boundingBox();
const bodyBoundingBox = await bodyHandle.boundingBox();
await bodyHandle.dispose();

// Scroll one viewport at a time, pausing to let content load
const viewportHeight = viewportOptions.height;
let viewportIncrement = 0;
while (viewportIncrement + viewportHeight < bodyBoundingHeight) {
const navigationPromise = page.waitForNavigation({waitUntil: 'networkidle0'});
while (viewportIncrement + viewportHeight < bodyBoundingBox.height) {
const navigationPromise = page.waitForNetworkIdle();
/* eslint-disable no-await-in-loop */
await page.evaluate(_viewportHeight => {
/* eslint-disable no-undef */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"dependencies": {
"@cliqz/adblocker-puppeteer": "^1.26.11",
"file-url": "^4.0.0",
"puppeteer": "^21.5.0",
"puppeteer": "^21.9.0",
"tough-cookie": "^4.1.3"
},
"devDependencies": {
Expand Down

0 comments on commit 731d77f

Please sign in to comment.