Skip to content

Screenshot

Screenshots generation is organized automatically for selenium tests via IScreenshotRule.java implementation(s). You can implement and register any custom rules based on your requirements.

Default AutoScreenshotRule.java depends on 2 configuration parameters:

auto_screenshot=true
allow_fullsize_screenshot=false

Example of the extended screenshot rule can be found here

When auto_screenshot enabled Carina capture screenshots after every important actions: click, type, page opening and of cause after driver and test failures. Via allow_fullsize_screenshot you can enable full size screenshoting for driver and test failures. Make sure to test its enabling in advance on your webapp. Huge pages concatenation might significantly slow down your tests execution.

Default timeout for capturing visible screen is EXPLICIT_TIMEOUT/3 and for fullsize screenshoting EXPLICIT_TIMEOUT/2

To disable completely automatic screenshots capturing clear all rules:

Screenshot.clearRules()

To capture screenshot explcitly from test code use:

Screenshot.capture(getDriver(), "my page screenshot");
Screenshot.capture(getDriver(), "Captureg full size screenshot", true);

FAQ

How can I find all places where automatic screenshot capturing is performed?

You can take a look into the DriverListener and CarinaListener to find call hierarchy.