Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,8 @@ class WebDriver extends Helper {
}

/* eslint-disable prefer-arrow-callback, comma-dangle, prefer-const */
const originalWindowSize = await this.browser.getWindowSize();

let { width, height } = await this.browser.execute(function () {
return {
height: document.body.scrollHeight,
Expand All @@ -1298,7 +1300,9 @@ class WebDriver extends Helper {

await this.browser.setWindowSize(width, height);
this.debug(`Screenshot has been saved to ${outputFile}, size: ${width}x${height}`);
return this.browser.saveScreenshot(outputFile);
const buffer = await this.browser.saveScreenshot(outputFile);
await this.browser.setWindowSize(originalWindowSize.width, originalWindowSize.height);
return buffer;
}


Expand Down