Skip to content

Advanced Screenshots

Bernd Weigel edited this page Nov 26, 2024 · 3 revisions

How to use the Advanced Screenshots

The normal screenshots provided by Selenide sometimes do not show everything that is needed to analyze a bug. Therefore Neodymium offers the option to use advanced screenshots.

Basic Functionality

To enable the use of advanced Screenshots one has to simply enable it in the properties.

neodymium.screenshots.enableAdvancedScreenshots = true

On default this will take normal screenshots of the viewport visible at the moment of failure. Only difference being that the screenshots are now stored in separate folders for each test class. As test class names can be similar for different areas you want to test, the folder names also contain the entire name of the package it is in.

For example the screenshots for test class BrowseTest which is in smoke sub-package would be stored like this:

folder_normal_example

They will also have a name containing the calling test method name, used browser profil, provided data set and a timestamp.

screenshot_example

Folder Tree Structure

With bigger Testsuites this folder structure could get quite confusing, as there will be a lot of folders with similar names. So in order to keep track of all the Screenshots. You have the option of automatically generating a folder tree structure. So for the example above this would look like this:

folder_normal_example

To activate this enable the neodymium.screenshots.enableTreeDirectoryStructure property.

Highlight Last Element

With CSS-selectors it is sometimes not clear which of the elements of a given website was handled last (and if it even was the correct element). For this Neodymium provides the option to highlight the last element that was evaluated or manipulated. By enabling the neodymium.screenshots.highlightLastElement property you will add highlighting to your screenshots.

highlighting_example

The default color can be changed. With the neodymium.screenshots.highlightColor property you can change the color to any RBG color you think fits your testreports the best. The color has to be given in a hexadecimal format. So for example:

neodymium.screenshots.highlightColor = #0000FF

will make your screenshot look like this:

highlighting_example_blue

Full Page Screenshots

Sometimes only seeing the viewport does not tell the entire story of a failure. Neodymium enables you to get fullpage screenshots with the neodymium.screenshots.fullpagecapture.enable property. To still be able to now were the current viewport was you can enable neodymium.screenshots.fullpagecapture.highlightViewport. So your screenshot can look like this:

fullpage_example

Again the color of the highlighting can be changed to any RBG color using the neodymium.screenshots.fullpagecapture.highlightColor proprety.

Clone this wiki locally