【问题标题】:testcafe firefox allow autoplaytestcafe firefox允许自动播放
【发布时间】:2019-12-10 12:16:07
【问题描述】:

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

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

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

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

问题:

我应该怎么做才能在 Firefox 中允许自动播放,使用它作为浏览器通过 testcafe 运行测试?

可能的猜测:

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

软件版本:
testcafe 1.7.0; Mozilla Firefox 71.0

提前致谢!

【问题讨论】:

    标签: javascript firefox automated-tests testcafe autoplay


    【解决方案1】:

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

    testcafe firefox:userProfile tests/test.js
    

    【讨论】:

      猜你喜欢
      • 2019-07-07
      • 1970-01-01
      • 2015-05-13
      • 2015-08-25
      • 2012-03-28
      • 1970-01-01
      • 2012-05-03
      • 2019-08-07
      • 1970-01-01
      相关资源
      最近更新 更多