how to record selenium webdriver test executions in python on window x64(如何在window x64上的python中记录selenium webdriver测试执行)
问题描述
使用 python 绑定 selenium3 webdriver 进行测试自动化,使用 castro 记录执行步骤,但在 Windows 7 x64 上失败.
Using python binding selenium3 webdriver for test automation, to record execution steps using castro but it is failing on Windows 7 x64.
是否有任何其他库或模块可用于记录目的
Is there any other library or module which can be used for recording purpose
带有 castro 的代码
Code with castro
from castro import Castro
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
def my_video_record():
castroObject = Castro(filename="video/mytest.swf")
castroObject.start()
firefoxDriver = webdriver.Firefox(executable_path="firefox_geckodriver64bit/geckodriver")
firefoxDriver.get("https://www.python.org")
assert "Python" in firefoxDriver.title
sleep(1)
firefoxDriver.quit()
castroObject.stop()
if __name__ == '__main__':
my_video_record()
但它会在我的 Windows7 x64 上引发错误
But it throws error on my Windows7 x64
Socket error: [Errno 10061] No connection could be made because the target machine actively refused it
Process Process-1:
Traceback (most recent call last):
File "D:Python27libmultiprocessingprocess.py", line 258, in _bootstrap
self.run()
File "D:Python27libmultiprocessingprocess.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "D:Python27libsite-packagescastrolibpyvnc2swfvnc2swf.py", line 611, in main
merge=merge, debug=debug, reconnect=reconnect)
File "D:Python27libsite-packagescastrolibpyvnc2swfvnc2swf.py", line 429, in vnc2swf
client.loop()
File "D:Python27libsite-packagescastrolibpyvnc2swf
fb.py", line 489, in loop
if not self.loop1(): break
File "D:Python27libsite-packagescastrolibpyvnc2swf
fb.py", line 276, in loop1
self.request_update()
File "D:Python27libsite-packagescastrolibpyvnc2swf
fb.py", line 551, in request_update
self.send('x03x01' + pack('>HHHH', *self.clipping))
AttributeError: RFBNetworkClient instance has no attribute 'clipping'
推荐答案
我不推荐使用 castro.它真的过时了,我已经尝试在自己的测试中使用它并且确实让它运行但它太不稳定了.
I do not recommend using castro. It's really outdated, I've tried using it in my own tests and did get it running but it was too unstable.
我目前正在使用 (屏幕录制软件),它就像一个魅力.它允许您设置帧率、分辨率、比特率以及选择不同的视频编解码器.
I'm currently using ffmpeg together with screen-capture-recorder (screen recording software) and it works like a charm. It allows you to set the framerate, resolution, bitrate as well as chose different video codec.
代码如下所示:
from subprocess import Popen
from subprocess import call
cmd = 'ffmpeg -y -rtbufsize 2000M -f dshow -i video="screen-capture-recorder" -s 1920x1080 -b:v 512k -r 20 -vcodec libx264 test.avi'
def terminate(process):
if process.poll() is None:
call('taskkill /F /T /PID ' + str(process.pid))
videoRecording = Popen(cmd) # start recording
terminate(videoRecording) # terminates recording
这篇关于如何在window x64上的python中记录selenium webdriver测试执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在window x64上的python中记录selenium webdriver测试执行


基础教程推荐
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 筛选NumPy数组 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01