【问题标题】:Couldn't connect to selenium server to execute a webdriverIO test无法连接到 selenium 服务器以执行 webdriverIO 测试
【发布时间】:2015-07-08 14:30:03
【问题描述】:

当我通过控制台执行 webdriverIO 测试时,我遇到了运行时错误。

这是错误无法连接到 selenium 服务器来执行 webdriverIO 测试。

我可以通过浏览器 (http://localhost:4444/wd/hub/static/resource/hub.html) 访问我的 selenium 服务器,但它仍然无法正常工作。

拜托,谁能帮帮我。

非常感谢您的帮助。

【问题讨论】:

    标签: selenium selenium-webdriver webdriver-io


    【解决方案1】:

    您是否尝试过此解决方案? https://github.com/webdriverio/webdriverio/issues/602

    具体来说,添加:

    var options = { desiredCapabilities: { browserName: 'chrome' }, host: 'localhost', port: 4444 };

    为我工作。

    【讨论】:

    • 完成! ,我点击了帖子左侧的大向上箭头,但没有任何变化,也许是为了我的声誉。再次感谢。 :-)
    【解决方案2】:

    很久以后,但我在 Appium 中遇到了这个问题,我想分享一下我发现的解决方法,以防其他人在 Appium 中遇到这个问题。

    1. 打开 Appium 服务器应用程序并使用主机:127.0.0.1 和端口:4723 启动服务器。
    2. 打开您的模拟器或连接设备。
    3. 再次运行指令以执行它。

    【讨论】:

      【解决方案3】:

      根据the docs

      Handling the Selenium server is out of scope of the actual WebdriverIO project.
      

      所以我们需要使用原始 ChromeDriver 或启动 Selenium 网格。使用后者运行并设置时

      WebDriver: {
        url: '<your-vaue-here>',
        browser: 'chrome',
        host: '127.0.0.1',
        port: 4444,
        ...
      

      不要忘记禁用codecept.config.js 部分,如下所示:

      services: [
          ['']
      ],
      ...
      

      否则两台服务器都会尝试使用 http://localhost:4444。

      警告:

      当通过run-workers 并行执行 codeceptJS 测试时,我观察到一些不稳定的行为,因为一些线程实际上会杀死 Selenium 网格,而其他线程仍在运行。要解决此问题,请禁用 services 部分并运行专用 Grid 服务器作为 CI 管道中的初始步骤(假设这是您实际需要并行性的地方)。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-01-08
        • 2016-12-16
        • 2018-03-19
        • 2010-11-13
        • 2012-01-24
        • 1970-01-01
        • 1970-01-01
        • 2018-08-09
        相关资源
        最近更新 更多