How to take screenshots in Selenium without coding

More minutes lost, again.

Your test just crashed, but you lack a screenshot action to understand what’s happening.

After some search, you find how to take a screenshot with Selenium.

You add the actions to take screenshots in your test in all places to don’t have the problem again. 

Your test is finally working after a few more iterations, but you have to remove all the screenshots actions as the test is too slow.

That’s a lot of time to implement a single test.

This article shares how you can take screenshots in Selenium without coding, implementing tests with fast feedback loops.

Follow Cerberus Testing for more open-source test automation.

Taking screenshots manually is complex

A manual implementation requires taking, storing, and visualizing screenshots during test execution.

Selenium Webdriver provides the action “getScreenshotAs” to take a screenshot on the browser session:

Figure 1: The screenshots actions available in Selenium Webdriver, Browserstack.

This is only the first step as once your file is stored, you can only visualize it opening the file system.

But you lose time coding all these mechanisms and your team still struggles to find the files associated with a specific execution.

Cerberus Testing simplifies screenshot action

Cerberus Testing is the open-source test automation platform natively providing screenshots features.

You can take screenshots with Selenium Webdriver without coding by:

  1. Adding “takeScreenshot” actions in your tests in low-code;
  2. Run a set of tests with conditional screenshots parameters (see next section);
  3. Natively visualize screenshots and associated HTML on the web interface.

These features are part of the product; you don’t have to lose time coding the different requirements and exceptions.

You save time by using a ready-to-use framework and enable team collaboration on a shared interface.

Add take screenshots action in your tests

Cerberus Testing provides a low-code library to support a flexible definition of test automation use-cases.

The structure of the framework defines test cases containing steps, actions, and controls.

Taking a screenshot requires one click:

Figure 2: The takeScreenshot action in low-code, Cerberus Testing.

You can add the “takeScreenshot” action anywhere in your tests as a control, optionally specifying the crop values.

All tests will take screenshots of the specific steps on execution.

Run a set of tests conditionally taking screenshots

Screenshots are useful to debug tests but slow down their duration.

Cerberus Testing lets you take screenshots based on the test execution behavior:

  • Disable all screenshots even if they are present in the tests;
  • Take a screenshots only for a failing action or control;
  • Systematically take a screenshot for every action.
Figure 3: The native screenshots options for test execution, Cerberus Testing.

You can keep the test structure simple and easily get screenshots only when you are debugging.

The parameters can be set at any level when triggering tests manually, from the campaign scheduler, or through APIs.

Natively visualize screenshots and HTML

The second problem to solve is to visualize the screenshots.

Cerberus Testing natively provides the screenshots in the web interface with the corresponding HTML content.

Figure 4: The systematic screenshots and HTML recording in Cerberus Testing, GitHub.

All your team members with granted access—including non-technical profiles—can directly access the information.

In the end, you accelerate test automation cycles.

Accelerate with open-source test automation

Screenshots seem like a simple topic, but it’s not.

The feature impacts various areas of a test automation framework, requiring an effort of setup and maintenance.

Contributing and using the same product through open-source can make us all accelerate.

Time is running to keep our software valuable to our users.

Accelerate for free with Cerberus Testing.

How to take screenshots in Selenium without coding
Scroll to top