0

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.

3 Answers 3

2

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.

1

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

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

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

0

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,

https://www.geeksforgeeks.org/create-a-screen-recorder-using-python/

https://python-mss.readthedocs.io/examples.html#opencv-numpy

https://www.thepythoncode.com/article/make-screen-recorder-python

https://www.section.io/engineering-education/create-a-screen-recorder-using-python-and-pycharm/

https://www.techgeekbuzz.com/how-to-make-a-screen-recorder-in-python/

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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