有没有办法在自动化testcafe测试用例的同时将js命令传递给开发控制台

is there a way to pass js command to dev console while automating testcafe testcase

这是流程:

  1. 打开主页
  2. 运行 开发控制台上的命令
  3. 继续其余的测试步骤

top.startTour("123", 0) 是命令

我正在编写一个自动化测试用例,其中我需要在 chrome 开发控制台上传递特定命令以激活我的测试用例所需的插件。我正在使用 testcafe 框架进行测试。

java JavaScriptExecutor 中有一个通过 selenium 支持的接口。我想看看是否有任何我可以使用的特定于 testcafe 的东西

您可以使用 t.eval 创建一个 one-time 使用客户端函数并在您的测试中执行它。该方案是否适用于您的场景?

您是否尝试过将脚本注入 head 标签

https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/inject-client-scripts.html#access-dom-in-the-injected-scripts

这可能有帮助