问题截图:
生成的视频:https://github.com/abbygo/Homework/blob/master/appium_xueqiu_normal/testcases/20200601195510.mp4
代码如下:
@pytest.fixture(scope=‘class’,autouse=True)
def record():
# 切割成一个数组,3个命令
now_time=time.strftime(“%Y%m%d%H%M%S”, time.localtime())
str="scrcpy --record "+now_time+‘.mp4’
cmd = shlex.split(str)
# shell =false ,不使用shell 这种方式,shell 所有的命令在一行,由于系统不同,不同系统使用的命令不一样,wind-cmd ,linux -bash
# stderr错误
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
yield
os.kill(p.pid, signal.CTRL_C_EVENT)
完整代码地址:https://github.com/abbygo/Homework/tree/master/appium_xueqiu_normal
环境:
scrcpy 1.11
win 10
麻烦老师们帮我看一下啦 ;我运行了老师的代码也是一样的问题,生成的视频打开提示文件无效