https://malinowski.dev/recording-headless-selenium-tests-to-mp4.html this is the link i am using but i don't even know how to do all these.I don't know whether i should run all the commands in that as a single script or should i run the xvfb command in one terminal and then open a new window for ffmpeg command for x11 grab.So,can anyone elaborate the steps for running test cases in xvfb and record the same.
Asked
Active
Viewed 342 times
-1
-
If you managed to solve your own problem, please post an **answer** with that solution. Do not edit your **question** to add things like "resolved" to the title or a solution to the body. That is what answers are for. – Mark Rotteveel Jul 27 '22 at 11:22
1 Answers
1
- create a
.sh
file(for Linux) and enter the below lines
xvfb-run --listen-tcp --server-num 93 -s "-ac -screen 0 1920x1080x24" (--command for running the program--) &
export DISPLAY=:93
ffmpeg -f x11grab -video_size 1920x1080 -i :93 -codec:v libx264 -r 12 video.mp4
- Add the below lines in the java program for invoking the driver in the same port as the virtual display is opened
System.setProperty("webdriver.gecko.driver","/home/saran/Downloads/geckodriver");
Map<String, String> environment = new HashMap<>();
environment.put("DISPLAY", ":93");
GeckoDriverService service = new GeckoDriverService.Builder().usingAnyFreePort().withEnvironment(environment).build();
driver = new FirefoxDriver(service);
- Finally execute the
.sh
file

Krishna Majgaonkar
- 1,532
- 14
- 25

Saran Raj
- 86
- 4