I'd like to have video recordings of the Selenium automation at work. And then delete the recording when the tests pass.

This way whenever the tests fail we can quickly replay the video to see what went wrong. Is there a free way to capture / record the screen while the automation is running?

I'm looking for something that wouldn't take up too much of disk space. And it's something that can be controlled via the program.

4 Answers 4


You can use docker image that Selenium provides for video recording. Since you use docker images in "remote driver" manner you can use those images from python code as well.


One of the simplest ways is to use the Castro library:

c = Castro(filename = "my-cool-selenium-video.swf")
# Run your Selenium scenario

Videos are saved on /tmp, so you can simply run rm -rf /tmp/my-cool-selenium-video.swf afterwards.


You can use libraries like pyautogui and numpy to write code to record screen by taking screenshots and then adding them into a video file.

I haven't tried is myself, but with a quick search on the internet I got these links that might help you,






Try these out and if any of it works do share the solution here so that other's may also benefit from it.


In every application, where user interface testing is performed, such scenarios of recording your automation script has become a common requirement in professional automation frameworks especially when you execute an automated nightly batch. Recording of test script is performed before start of your automation script and ends at tear down followed by saving recording at your local end. The best way to accomplish this task is to use Python with Castro which is a third party library.

Castro can be installed using below simple steps -

easy_install Castro or from pip command - pip install Castro

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.