testcafe firefox允许自动播放

问题描述 投票:2回答:1

我使用testcafe编写了一些测试。我认为它们的内容不值得一提。其中一些依赖于浏览器自动播放音频的能力。

当我使用Chrome运行测试时testcafe "chrome --autoplay-policy=no-user-gesture-required" testfile.js一切正常,页面上的音频开始自动播放。

但是,当我使用Firefox时:testcafe "firefox" test_widget.js自动播放已禁用,并且没有音频正在播放。如果我添加--autoplay-policy=no-user-gesture-required,则什么都没有改变。

autoplay disabled flag

firefox -h检查可用参数没有得到有价值的结果。

问题:

我应该怎么做才能在Firefox中使用自动播放功能,将其用作浏览器,以通过testcafe运行测试?]

可能的猜测:

  • 命令中的某些标志
  • 测试文件中的某些代码

软件版本:testcafe 1.7.0; Mozilla Firefox 71.0

谢谢!

javascript firefox testcafe autoplay
1个回答
0
投票

您可以允许使用浏览器设置进行自动播放,并使用当前的user profile启动Firefox:

testcafe firefox:userProfile tests/test.js
© www.soinside.com 2019 - 2024. All rights reserved.