-
Notifications
You must be signed in to change notification settings - Fork 20
No way to shut off screenshots on error. #15
Comments
From @pmerwin on December 30, 2017 17:4 I tried setting browser.takesScreenshot = false; but a screenshot is still taken when I set this in the fucntion that uses the try block, the 'setting' is not rejected, but it just does not do anything :const shouldTakeScreenshot = options.screenshotOnReject || typeof options.screenshotPath === 'string'
|
From @vbyjsue on January 12, 2018 9:28 This is the workaround I'm using in v.4.8. Disables screenshot if first attempt failes, enables it for second attempt. const currentScreenshotPath = browser.options.screenshotPath;
try {
browser.options.screenshotPath = null;
browser.click(selector);
browser.options.screenshotPath = currentScreenshotPath;
} catch(e) {
browser.options.screenshotPath = currentScreenshotPath;
browser.execute(`scrollBy(0, ${yOffset})`);
browser.click(selector);
} |
From @pmerwin on February 5, 2018 17:51 Awesome thanks, I will give this a try ^^^ |
From @daposy on February 7, 2018 0:31 @vbyjsue thanks for sharing your solution. Its a usable workaround for now. This issue is particularly annoying when interacting with iOS system messages. Using the documentation recommended solution for
|
From @mherodev on February 14, 2018 0:9 Thanks @vbyjsue! This was also a workable solution for me. |
From @worc on May 24, 2018 22:8 this issue has a wider impact when the tests are unable to create screenshots, like in this issue the screenshot failure blocks logging of the failed test case. so now i have dozens of browser instances running, no screenshots, and no way to tell which tests failed. |
From @pmerwin on December 30, 2017 16:55
The problem
There is no way to shut off taking a screenshot on error. We are using Try/Catch and expect errors, and do not need screenshots when that happens, as this slows down the test, and creates more possibility for something to go wrong.
Environment
*testrunner
Details
I want to set take screenshot to false inside of try blocks, as when we get an error in a try block, wdio is still taking a screenshot. I want to turn this off/on in my function called from my tes.t
Link to Selenium/WebdriverIO logs
AVailable if needed
Code To Reproduce Issue [ Good To Have ]
available if needed, I have posted on gitter chat for any suggestions and have not received a response. Thanks in advance!
"// Saves a screenshot to a given path if a command fails.
screenshotPath: config.wdio.errors,
//
Anyone know how to shut this off at spec/function level. We use Try/Catch and don't need a screen shot when an error is expected. The only option I see to change is the above. Tried setting this to null, did not work.
Any help? Just wondering what value to set in a local function try/catch that will shut off snapshots on error as I am expecting an error and do not need a snapshot. I thought if the error happened in the try block it should not trigger a snapshot but it does."
Copied from original issue: webdriverio/webdriverio#2529
The text was updated successfully, but these errors were encountered: