diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index a53d08787..cdd0229f2 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -1800,6 +1800,13 @@ class WebDriver extends Helper { const originalWindowSize = await this.browser.getWindowSize() + // this case running on device, so we could not set the windowSize + if (this.browser.isMobile) { + this.debug(`Screenshot has been saved to ${outputFile}, size: ${originalWindowSize.width}x${originalWindowSize.height}`) + const buffer = await this.browser.saveScreenshot(outputFile) + return buffer + } + let { width, height } = await this.browser .execute(function () { return {