Selenium WebDriver:连接被拒绝(连接被拒绝)

我在mean.js 4.2版上运行npmtesting,它在量angular器e2etesting上给我一个“连接被拒绝”的错误。 我试图像这样说更新selenium。 现在是2.27版本,另一个堆栈溢出post是2.24。 Chrome驱动程序是否再次中断?

Running "protractor:e2e" (protractor) task webdriver-manager path: /Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager selenium standalone is up to date. chromedriver is up to date. Starting selenium standalone server... [launcher] Running 1 instances of WebDriver Selenium standalone server started at http://192.168.0.30:53658/wd/hub /Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/selenium-webdriver/lib/atoms/error.js:108 var template = new Error(this.message); ^ UnknownError: Connection refused (Connection refused) at new bot.Error (/Users/tdiddy/meaning42/node_modules/grunt-protractor-runner/node_modules/selenium-webdriver/lib/atoms/error.js:108:18) 

在这方面,为了回答你的问题,我相信chromedriver 2.27是不会使用的…这就是为什么:

“以http:开头的Selenium独立服务器”意味着您已经启动了本地驱动程序提供程序的Selenium独立服务器。 使用本地驱动程序提供程序启动“量angular器版本4”(grunt-protractor-runner使用“量angular器版本”^ 4.0.0)时,使用的驱动器版本是webdriver-managerconfiguration中指定的版本。 只是因为你下载2.27并不意味着在本地启动时量angular器将使用量angular器2.27。

有两种方式使用chromedriver 2.27:

  • 在启动本地驱动程序提供程序时,需要使用量angular器5来使用上次下载的二进制文件 。 下载chromedriver 2.27和webdriver-manager update --versions.chrome 2.27然后启动你的量angular器testing。
  • 不要使用本地驱动程序提供程序。 使用webdriver-manager update --versions.chrome 2.27下载你的二进制文件,然后用webdriver-manager start --versions.chrome 2.27启动你的selenium独立服务器。 一旦启动,在你的configuration中使用seleniumAddress: "http://localhost:4444/wd/hub"启动它seleniumAddress: "http://localhost:4444/wd/hub"

为什么你得到的Connection refused可能是因为您正在使用的chromedriver版本运行的Chrome版本不兼容。 我会build议尝试两个build议的组合:使用Protractor 5.0.0您的configuration中使用seleniumAddress 。 如果这个组合失败了,请随时打开一个问题 。

我得到这个错误和更新chromedriver到v2.32通过brew( brew update chromedriver )修复它为我