首页 > 解决方案 > 无法从 OSX 上的 Testcafe IDE 连接到站点

问题描述

我的灯具是这样设置的

{
  "fixtures": [
    {
      "name": "login",
      "pageUrl": "http:\/\/localhost:3000\/",
      "tests": [
        {
          "name": "type name",
          "commands": [
            {
              "type": "type-text",
              "studio": {

              },
              "callsite": "0",
              "selector": {
                "type": "js-expr",
                "value": "input[type=email]"
              },
              "options": {

              },
              "text": "example@email.com"
            }
          ]
        }
      ]
    }
  ]
}

通过一个简单的测试来查找输入并输入一些文本但是在运行命令时我得到

testcafe chrome login.testcafe
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.

Type "testcafe -h" for help.

我已经在他们的问题板上多次看到这个问题,其中一个与 Linux 服务器上的 CI 集成有关,另一个似乎与尝试连接到 localhost 的类似问题

https://github.com/DevExpress/testcafe-browser-provider-electron/issues/20 https://github.com/DevExpress/testcafe/issues/1133

testcafe 的新手,任何帮助将不胜感激!

标签: testingautomated-testse2e-testingweb-testingtestcafe

解决方案


我找到了解决方案,一些网络策略不允许在我的示例中的某些端口上访问您的机器,它是 57501。

testcafe chrome login.testcafe --hostname localhost

添加 --hostname 解决了这个问题

文件

https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--hostname-name

我仍然不知道如何从 IDE 启动,但这解决了我的主要问题。


推荐阅读