Many of you are probably familiar with capturing screenshots of web pages during test execution. Wouldn’t it be great if you could record videos of your Selenium test cases automatically? Let’s find out how you can do it.
Why we need video recordings of Selenium test cases
Video recordings of Selenium test case execution can play a critical role. Not only would these help in debugging issues more efficiently, we can use recorded videos to show test execution activities to the client or internal stakeholders. Additionally, these recorded videos can be added to the project management tool while creating bugs, which helps in understanding the bug clearly.
Does Selenium WebDriver have a built-in feature to record videos of test cases?
No. Selenium WebDriver does not have any built-in mechanism to record videos of the test cases that are executed.
Here is a one-stop solution that your devops team needs scriptless automation. || Leverage our vast IT experience to establish a culture where building, testing, and releasing software happens rapidly, frequently, and reliably.
Then, how can we achieve it?
You can video record Selenium WebDriver test cases in six steps.
1. Download ATUTestRecorder.jar and ATUReporter_Selenium_testNG.jar
These two jars are available on the internet, and one can simply Google to download them.
2. Add these jar files into a project folder.
Create a folder called executables inside the project and save the jars in this folder.
Best Practices:
Instead of creating a folder in any desired location of the local computer, it’s best practice to create a folder inside the project.
Advantages:
- Avoid hard-coding of the path of the folder when writing the script
- We can use System.getProperty("user.dir") to get the base folder path of the project which works irrespective of the location the project is saved.
3. Add ATUTestRecorder.jar and ATUReporter_Selenium_testNG.jar to project build path
We should follow the steps below to add jars to the Build path:
Right-click on project >> Select "Properties" >> Select “Java Build Path” >> Select “Libraries” tab >> Click on “Add External Jars” button >> Select ATUTestRecorder.jar and ATUReporter_Selenium_testNG.jar >> Apply >> OK.
4. Create a folder to store recorded videos
Create a folder with the name ScriptVideos inside the project.
Best Practices:
Instead of creating a folder in any desired location of the local computer, it’s best practice to create a folder inside the project.
Advantages:
- Avoid hard-coding of the path of the folder when writing the script.
- We can use System.getProperty ("user.dir") to get the base folder path of the project which works irrespective of the location the project is saved.
Our Digital Strategy Practice creates long-term digital roadmaps by leveraging people, processes, and tools to improve efficiency and innovation. || Sign up today for the latest news about your Digital Transformation.
5. Create and run the test
- Declare ATUTestRecorder in SetUp class
/** The recorder. */
ATUTestRecorder recorder;
- Use the following code in @BeforeMethod:
Best Practices:
- Use the reflection concept from Java to get the test case name and use the same for the video. This helps in identifying the video by seeing the name.
- Append the name of the video with the timestamp. This helps to create videos, which run multiple times without overriding the old videos.
Use the following code in @AfterMethod:
Additional things to set up when using Maven project and pom.xml
6. Videos will be created with a .mov extension. You can play them to see recorded videos
Check the folder, which is used for the videos. We will find the test case videos with the .mov extension. These videos will be automatically named as [testcase name-timestamp].mov
BONUS!
Do you want to delete old videos before starting an execution?
Follow the steps below:
Create a method to delete the old video recordings in Utils class.
Call the method in @BeforeSuite
At TA Digital, we instituted auto-video recording of test cases into the core automation framework and use these videos for defect tracking. This has proved its effectiveness in a few of the recent projects where the clients and the development team have a clear understanding of the issue by just watching the video. The clients were delighted with the implementation of this and overjoyed to experience an approach where they have a very clear understanding of the issue.
About TA Digital
TA Digital is the only global boutique agency that delivers the “best of both worlds” to clients seeking to achieve organizational success through digital transformation. Unlike smaller, regional agencies that lack the ability to scale or large organizations that succumb to a quantity-over-quality approach, we offer resource diversity while also providing meticulous attention to the details that enable strategic success.
Over the past 20 years, TA Digital has positioned clients to achieve digital maturity by focusing on data, customer-centricity, and exponential return on investment; by melding exceptional user experience and data-driven methodologies with artificial intelligence and machine learning, we enable digital transformations that intelligently build upon the strategies we set into motion. We are known as a global leader that assists marketing and technology executives in understanding the digital ecosystem while identifying cultural and operational gaps within their business – ultimately ushering organizations toward a more mature model and profitable digital landscape.
Recognized in 2013, 2014, 2015, 2019, 2020 and 2021 Inc. 5000 list as one of the fastest growing companies in the United States, TA Digital is pleased also to share high-level strategic partnerships with world class digital experience platform companies like Adobe, SAP, Acquia, commercetools, Sitecore, and Elastic Path.
Explore TA Digital

Work
See what we’ve done for our clients – and what we can do for you.

Solutions
Our teams specialize in solving your biggest digital transformation challenges.

Services
Content. Data. Experience. Let us help guide your digital transformation.

Partners & Platforms
Put our partnerships with world-class digital experience platforms to work for you.

Contact Us
Let’s talk about getting your business where you want it to go.

Perspectives
Get expert analysis on trends and developments affecting your business.