如何视频记录在docker内部无头运行的硒测试? [英] How to video-record selenium tests running headless inside a docker?

查看:93
本文介绍了如何视频记录在docker内部无头运行的硒测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用无头firefox在docker内部运行python-selenium测试.

I am running python-selenium tests inside a docker using a headless firefox.

在这些测试过程中,我可以使用selenium方法来制作屏幕快照,但是我可以在整个测试过程中使用某些东西来视频"记录虚拟显示(一些测试脚本具有多种测试方法,并且启动了许多网络驱动程序,停止).

During these tests I am able to make screenshots with the selenium method for screenshots - but can I use something to 'video' record the virtual display during the whole test (several test scripts with several test methods, with many webdrivers started and stopped).

那么我该如何录制完整的测试会话呢?

So how can I video-record a complete test session?

附录:我找到了一个准确描述我需要的网页:

Addendum: I have found a webpage that describes exactly what I need: here. Unfortunately I get an error when I try to do the recording. Here are the commands I am doing:

xvfb-run --listen-tcp --server-num 44 --auth-file /tmp/xvfb.auth -s "-ac -screen 0 1920x1080x24" python seltest.py &
ffmpeg -f x11grab -video_size 1920x1080 -i 127.0.0.1:44 -codec:v libx264 -r 12 /tmp/behat_1.mp4

,错误是(对于第二个命令):

and the error is (for the second command):

[x11grab @ 0x1d289c0] Cannot open display 127.0.0.1:44, error 1.
127.0.0.1:44: Input/output error

推荐答案

使用ffmpeg记录虚拟显示的正确步骤是:

The correct steps to record the virtual display with ffmpeg are:

xvfb-run --listen-tcp --server-num 44 --auth-file /tmp/xvfb.auth -s "-ac -screen 0 1920x1080x24" python seltest.py &
export DISPLAY=:44
ffmpeg -f x11grab -video_size 1920x1080 -i :44 -codec:v libx264 -r 12 video.mp4

这篇关于如何视频记录在docker内部无头运行的硒测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆