【发布时间】:2017-06-18 12:37:59
【问题描述】:
版本
"nightwatch": "^0.9.16"
"chromedriver": "^2.30.1"
"selenium-server-standalone-jar": "^3.4.0"
我正在使用守夜人,但那 sh 我也尝试过
我正在使用 nightwatch 在 this repo 中运行 Selenium,并且我已经尝试使用 chrome 和 firefox 驱动程序,但都没有运气。
我有selenium standalone 和chromedriver 包,我知道路径就在nightwatch.conf.js:
const jar = require('selenium-server-standalone-jar')
console.log(jar.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.4.0.jar
const chromedriver = require('chromedriver')
console.log(chromedriver.path) // logs /home/goldylucks/apps/ci-workshop/node_modules/chromedriver/lib/chromedriver/chromedriver
'selenium': {
'start_process': true,
'server_path': jar.path,
'log_path': '',
'port': 4444,
'cli_args': {
'webdriver.chrome.driver': chromedriver.path,
'webdriver.ie.driver': '',
},
},
'test_settings': {
'chrome': {
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
},
},
但当我运行测试时,它会超时并挂起:
$ yarn e2e:ui
yarn e2e:ui v0.24.6
$ nightwatch -e chrome
Starting selenium server... started - PID: 12936
[App E2e Ui] Test Suite
===========================
✖ Timed out while waiting for element <body> to be present for 5000 milliseconds. - expected "visible" but got: "not found"
at Object.before (/home/goldylucks/apps/ci-workshop/test/ui/app.e2e-ui.js:9:8)
我尝试了以下组合: 1.使用在另一个终端上为应用程序提供服务的快递服务器 2.没有快递服务器 3.上面的每一个都用chromedriver在另一个终端手动启动(我真的认为这不重要,我应该这样做,只是想彻底......)
手动运行 chromedriver 会产生以下结果并挂起:
$ node_modules/chromedriver/lib/chromedriver/chromedriver
Starting ChromeDriver 2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5) on port 9515
Only local connections are allowed.
我也尝试使用 firefox 运行,但没有成功,这让我相信问题比 chromedriver 更严重,即与 selenium 与 nightwatch 交互有关。
【问题讨论】:
标签: selenium selenium-chromedriver nightwatch.js