My selenium tests are triggered from Jenkins server which in AWS EC2-Ubuntu. But in EC2, since tests run on chrome-headless, debugging has become difficult. I tried XVFB display but had unresolved issues installing and connecting to it. I am checking here to see if there is any other option to view chrome browser on EC2. Other alternate configuration or architectural options to make this set up work are also welcome.
-
This may be helpful tadigital.com/blog/…– Mohamed Sulaimaan SheriffCommented Jul 29, 2020 at 10:29
-
@MohamedSulaimaanSheriff, Thanks for the answer. The idea is to watch the test in real time. And even if I install this app in EC2, there's no way I can watch the video coz EC2 does not have a UI.– AfsalCommented Jul 29, 2020 at 10:47
-
Is there any server running in your ec2? or only using it for selenium. If it is okay you can watch the video after the test has been completed– Mohamed Sulaimaan SheriffCommented Jul 29, 2020 at 10:49
-
It has Jenkins server. Tests are started from Jenkins which I log into from my local machine.– AfsalCommented Jul 29, 2020 at 10:50
-
Okay! but it will be good if you have working apache or node server in your ec2 so that you can save the video output from the AU recorder in the apache/node directory path and download it using the ec2 public ip after the test is done– Mohamed Sulaimaan SheriffCommented Jul 29, 2020 at 10:53
|
Show 1 more comment
1 Answer
Selenium allows us to take screenshots of the browser viewport, even if the browser is running in headless mode. We can use that functionality to generate a video recording. After all, a video is just a set of frames. Taking a screenshot with Selenium is easy:
driver.save_screenshot("screenshot.png")
Source - Liviu Lupei
The article continues on to show how to stitch those together into a video, using FFmpeg.