C
C
Che_Bu_Rashka2017-05-17 11:11:21
Java
Che_Bu_Rashka, 2017-05-17 11:11:21

How to disable screenshots in Selenium?

There is a code in which I configure (capabilities) not to take a screenshot before starting WedDriver.

System.setProperty("webdriver.chrome.driver", Config.getWebdriver());
ChromeOptions options = new ChromeOptions();
options.setBinary(Config.getBrowser());
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
capabilities.setCapability("takesScreenshot", false);
WebDriver driver = new ChromeDriver(capabilities);
driver.get(Config.getURL());
//  какой-то код
........

We continue to work, but if some Exception occurs, then Selenium takes a screenshot in the /build/reports/tests folder.
It turns out the option capabilities.setCapability("takesScreenshot", false); didn't help.
The stack falls out , where you can see that takesScreenshot = TRUE .
How can I force Selenium not to take screenshots? And why was my capabilities not taken into account, so to speak, when creating the driver?
In the log here:
Exception log
Capabilities [{
applicationCacheEnabled=false,
rotatable=false,
mobileEmulationEnabled=false,
networkConnectionEnabled=false,
chrome={chromedriverVersion=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),userDataDir=/tmp/.org.chromium.Chromium.2MzIvi},
takesHeapSnapshot=true,
pageLoadStrategy=normal,
databaseEnabled=false,
handlesAlerts=true,
hasTouchScreen=false,
version=58.0.3029.96,
platform=LINUX,
browserConnectionEnabled=false,
nativeEvents=true,
acceptSslCerts=true,
locationContextEnabled=true,
webStorageEnabled=true,
browserName=chrome,
takesScreenshot=true,
javascriptEnabled=true,
cssSelectorsEnabled=true,
unexpectedAlertBehaviour=}]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-05-17
@sim3x

stackoverflow.com/questions/40558266/how-to-disabl...
stackoverflow.com/a/14716279

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question