量角器独立selenium失败:错误:等待WebDriver服务器的超时时间

Joe*_*Joe 7 selenium protractor

我已经在独立的selenium服务器上安装了量角器:

webdriver-manager update
Run Code Online (Sandbox Code Playgroud)

如果我运行量角器并且独立服务器已经运行并且配置指向该selenium实例它可以正常工作.

我想让量角器启动服务器,然后运行测试.默认情况下,量角器找到chrome驱动程序和selenium服务器jar,所以我使用的是最小配置:

exports.config = {
    capabilities: {
        'browserName': 'chrome'
    },
    specs: ['test/e2e/*.js']
};
Run Code Online (Sandbox Code Playgroud)

但是当它启动时它无法连接到服务器.

Error: Timed out waiting for the WebDriver server at http://192.168.1.146:56159/
wd/hub
Run Code Online (Sandbox Code Playgroud)

我注意到当使用webdriver-manager启动seleniumn时,服务器在localhost上启动.我似乎无法让量角器做同样的事情.

我的猜测是防火墙阻止了连接.

环境版本信息: - grunt v0.4.1
- 节点0.10.18 - selenium-server-standalone-2.37.0.jar - selenium-server-standalone-2.38.0.jar - 量角器0.14.0 - windows 7 Pro

And*_*s D 3

将服务器添加到您的配置中:

exports.config = {
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',

  capabilities ...
}
Run Code Online (Sandbox Code Playgroud)

  • 谢谢。将服务器添加到配置中意味着您正在运行一个独立的 selenium 服务器。这就是我最终所做的。我必须为此启动一个单独的任务,并等待它在启动 selenium 之前初始化服务器。很痛苦。有一条更具确定性的路径,但它似乎只有在我不在公司 VPN 上时才有效。 (2认同)