Skip to content

Commit 153012c

Browse files
committed
fix(appium): error when saving screenshot
1 parent cb22be8 commit 153012c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/helper/WebDriver.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,13 @@ class WebDriver extends Helper {
18001800

18011801
const originalWindowSize = await this.browser.getWindowSize()
18021802

1803+
// this case running on device, so we could not set the windowSize
1804+
if (this.browser.isMobile) {
1805+
this.debug(`Screenshot has been saved to ${outputFile}, size: ${originalWindowSize.width}x${originalWindowSize.height}`)
1806+
const buffer = await this.browser.saveScreenshot(outputFile)
1807+
return buffer
1808+
}
1809+
18031810
let { width, height } = await this.browser
18041811
.execute(function () {
18051812
return {

0 commit comments

Comments
 (0)