"Connection refused! Is selenium server started?" 使用 ChromeDriver 和 Chrome 的 VueJS Nightwatch E2E 测试错误
"Connection refused! Is selenium server started?" error in VueJS Nightwatch E2E tests using ChromeDriver and Chrome
我有一个具有默认 Nightwatch E2E 测试的 VueJS 应用程序。我只是花了一些时间来设置用户帐户和身份验证。这样做之后,当我尝试 运行 我的 E2E 测试时,它们神秘地失败了。这是我得到的命令行输出:
code/premium-poker-tools [master●] » npm run e2e
> premium-poker-tools@1.0.0 e2e /Users/adamzerner/code/premium-poker-tools
> node test/e2e/runner.js
> Starting dev server...
Starting to optimize CSS...
> Listening at http://localhost:8080
Starting selenium server... started - PID: 58502
[BABEL] Note: The code generator has deoptimised the styling of "/Users/adamzerner/code/premium-poker-tools/test/e2e/specs/hit-calculator.js" as it exceeds the max of "500KB".
player
1
2
3
1) "before all" hook
0 passing (2s)
1 failing
1) player "before all" hook:
Connection refused! Is selenium server started?
npm ERR! code ELIFECYCLE
npm ERR! errno 10
npm ERR! premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
npm ERR! Exit status 10
npm ERR!
npm ERR! Failed at the premium-poker-tools@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamzerner/.npm/_logs/2019-05-23T19_47_08_016Z-debug.log
code/premium-poker-tools [master●] »
这里是 /Users/adamzerner/.npm/_logs/2019-05-27T17_44_07_557Z-debug.log
:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.11.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'e2e' ]
2 info using npm@6.9.0
3 info using node@v11.11.0
4 verbose run-script [ 'pree2e', 'e2e', 'poste2e' ]
5 info lifecycle premium-poker-tools@1.0.0~pree2e: premium-poker-tools@1.0.0
6 info lifecycle premium-poker-tools@1.0.0~e2e: premium-poker-tools@1.0.0
7 verbose lifecycle premium-poker-tools@1.0.0~e2e: unsafe-perm in lifecycle true
8 verbose lifecycle premium-poker-tools@1.0.0~e2e: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/adamzerner/code/premium-poker-tools/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/adamzerner/.rvm/bin
9 verbose lifecycle premium-poker-tools@1.0.0~e2e: CWD: /Users/adamzerner/code/premium-poker-tools
10 silly lifecycle premium-poker-tools@1.0.0~e2e: Args: [ '-c', 'node test/e2e/runner.js' ]
11 silly lifecycle premium-poker-tools@1.0.0~e2e: Returned: code: 10 signal: null
12 info lifecycle premium-poker-tools@1.0.0~e2e: Failed to exec e2e script
13 verbose stack Error: premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
13 verbose stack Exit status 10
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:197:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:197:13)
13 verbose stack at maybeClose (internal/child_process.js:984:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid premium-poker-tools@1.0.0
15 verbose cwd /Users/adamzerner/code/premium-poker-tools
16 verbose Darwin 18.6.0
17 verbose argv "/usr/local/Cellar/node/11.11.0/bin/node" "/usr/local/bin/npm" "run" "e2e"
18 verbose node v11.11.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 10
22 error premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
22 error Exit status 10
23 error Failed at the premium-poker-tools@1.0.0 e2e script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 10, true ]
首先,Connection refused! Is selenium server started?
错误似乎是错误的。上面写着 Starting selenium server... started - PID: 58502
,我看到一个 Chrome 浏览器非常短暂地弹出然后立即关闭。
这里是有问题的 before
块的代码:
before(function (browser, done) {
console.log(1);
equityCalculator = browser.page['equity-calculator']();
console.log(2);
equityCalculator.navigate();
console.log(3);
browser.pause(20000);
equityCalculator
.waitForElementVisible('@app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
;
});
我一直在努力查明问题出在哪里,但遇到了很多麻烦。 1
、2
和 3
被注销,但 4
或 5
不会注销,所以这很有帮助。但是,如果 3
被注销,为什么 browser.pause(20000)
不工作?
我也一直在尝试修改我的实际代码以查看问题出在哪里。我在 main.js
中尝试了一些 alert
语句来尝试查明问题:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
alert(1);
window.$ = require('jquery');
require('bootstrap');
alert(2);
import Vue from 'vue';
import store from '@/store';
import App from './App';
import router from './router';
import monkeyPatches from '@/services/monkey-patches';
import axios from 'axios';
import VueAxios from 'vue-axios';
alert(3);
Vue.config.productionTip = false
Vue.use(VueAxios, axios);
axios.interceptors.request.use(
function(config) {
config.withCredentials = true;
return config;
},
function(error) {
return Promise.reject(error);
}
);
/* eslint-disable no-new */
new Vue({
el: '#app',
router: router,
store: store,
template: '<App/>',
components: { App }
});
$(function () {
$('[data-toggle="popover"]').popover();
});
// if (navigator.serviceWorker) {
// navigator.serviceWorker.register('/service-worker.js').catch(function() {
// console.log('Service worker registration failed.');
// });
// }
但奇怪的是,alert(1)
甚至无法正常工作。所以我感到很茫然。据我了解,main.js
的顶部是 Vue 应用程序的 "beginning",如果它甚至没有达到那个点,这是怎么回事? equityCalculator = browser.page['equity-calculator']();
和 equityCalculator.navigate();
看起来很标准。这是页面对象的片段:
module.exports = {
url: 'http://localhost:8080/equity-calculator',
elements: {
'app': '#app',
当我启动我的开发服务器并转到 url 时,一切正常。在我实施用户帐户和身份验证之前,我的端到端测试都运行良好,我没有更改此文件,但现在我遇到了问题。
我不确定我可以从这里去哪里。求助!
更新:
摘自package.json
:
{
...
"dependencies": {
...
"chromedriver": "^2.45.0",
"cross-spawn": "^6.0.5",
"nightwatch": "^0.9.21",
"selenium-server": "^3.141.59",
},
}
这是nightwatch.conf.js
:
require('babel-register')
let config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
page_objects_path: 'test/e2e/page-objects',
globals_path: 'test/e2e/globals.js',
test_runner : 'mocha',
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port),
handStrings: [
'aa', 'aks', 'aqs', 'ajs', 'ats', 'a9s', 'a8s', 'a7s', 'a6s', 'a5s', 'a4s', 'a3s', 'a2s',
'ako', 'kk', 'kqs', 'kjs', 'kts', 'k9s', 'k8s', 'k7s', 'k6s', 'k5s', 'k4s', 'k3s', 'k2s',
'aqo', 'kqo', 'qq', 'qjs', 'qts', 'q9s', 'q8s', 'q7s', 'q6s', 'q5s', 'q4s', 'q3s', 'q2s',
'ajo', 'kjo', 'qjo', 'jj', 'jts', 'j9s', 'j8s', 'j7s', 'j6s', 'j5s', 'j4s', 'j3s', 'j2s',
'ato', 'kto', 'qto', 'jto', 'tt', 't9s', 't8s', 't7s', 't6s', 't5s', 't4s', 't3s', 't2s',
'a9o', 'k9o', 'q9o', 'j9o', 't9o', '99', '98s', '97s', '96s', '95s', '94s', '93s', '92s',
'a8o', 'k8o', 'q8o', 'j8o', 't8o', '98o', '88', '87s', '86s', '85s', '84s', '83s', '82s',
'a7o', 'k7o', 'q7o', 'j7o', 't7o', '97o', '87o', '77', '76s', '75s', '74s', '73s', '72s',
'a6o', 'k6o', 'q6o', 'j6o', 't6o', '96o', '86o', '76o', '66', '65s', '64s', '63s', '62s',
'a5o', 'k5o', 'q5o', 'j5o', 't5o', '95o', '85o', '75o', '65o', '55', '54s', '53s', '52s',
'a4o', 'k4o', 'q4o', 'j4o', 't4o', '94o', '84o', '74o', '64o', '54o', '44', '43s', '42s',
'a3o', 'k3o', 'q3o', 'j3o', 't3o', '93o', '83o', '73o', '63o', '53o', '43o', '33', '32s',
'a2o', 'k2o', 'q2o', 'j2o', 't2o', '92o', '82o', '72o', '62o', '52o', '42o', '32o', '22',
],
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
对于Java/JDK:
code/premium-poker-tools-api [master] » java --version
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
当我查看 Java 控制面板时,它说我是最新的。
我不确定如何确定我使用的是哪个 Selenium 版本或 Chrome 版本。对于 Chrome,如果我打开 Chrome 并转到 "About Google Chrome",它会显示 74.0.3729.169
,这是最新版本,我假设我的测试使用的是相同的版本。
此日志消息...
Starting selenium server... started - PID: 58502
以及随后的错误消息...
Connection refused! Is selenium server started?
...暗示 WebDriver 实例,即 ChromeDriver 虽然启动但无法与 WebBrowsing 通信,即 Chrome session.
关于以下内容的更多详细信息:
- Selenium 版本。
- JDK版本.
- Selenium 服务器 模式 (Standalone/Grid).
- ChromeDriver版本.
- Chrome版本.
本可以帮助我们以更好的方式调试问题。但是,正如您提到的 “1、2 和 3 被注销,但 4 或 5 没有注销”,问题可能源于以下代码块:
equityCalculator
.waitForElementVisible('@app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
原因
根据讨论Connection refused! Is selenium server started nightwatch on edge,您的主要问题似乎是您使用的二进制文件版本之间不兼容。
解决方案
- 将JDK升级到最近的水平JDK 8u212。
- 将 Selenium 升级到当前水平 Version 3.141.59。
- 将ChromeDriver升级到ChromeDriver v74.0级别。
- 将Chrome版本升级到Chromev74级别。 (as per ChromeDriver v74.0 release notes)
- 通过 IDE 和 重建你的项目只需要依赖。
- 如果您的基本 Web Client 版本太旧,则卸载它并安装最新的 GA 和发布版本的 Web Client。
- 系统重启。
- 执行你的
@Test
.
- 始终在
tearDown(){}
方法中调用 driver.quit()
来关闭和销毁 WebDriver 和 Web Client 实例优雅。
结尾
分辨率
updating
npm 解决了这个问题(根据 OP 的评论)
npm update
我有一个具有默认 Nightwatch E2E 测试的 VueJS 应用程序。我只是花了一些时间来设置用户帐户和身份验证。这样做之后,当我尝试 运行 我的 E2E 测试时,它们神秘地失败了。这是我得到的命令行输出:
code/premium-poker-tools [master●] » npm run e2e
> premium-poker-tools@1.0.0 e2e /Users/adamzerner/code/premium-poker-tools
> node test/e2e/runner.js
> Starting dev server...
Starting to optimize CSS...
> Listening at http://localhost:8080
Starting selenium server... started - PID: 58502
[BABEL] Note: The code generator has deoptimised the styling of "/Users/adamzerner/code/premium-poker-tools/test/e2e/specs/hit-calculator.js" as it exceeds the max of "500KB".
player
1
2
3
1) "before all" hook
0 passing (2s)
1 failing
1) player "before all" hook:
Connection refused! Is selenium server started?
npm ERR! code ELIFECYCLE
npm ERR! errno 10
npm ERR! premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
npm ERR! Exit status 10
npm ERR!
npm ERR! Failed at the premium-poker-tools@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/adamzerner/.npm/_logs/2019-05-23T19_47_08_016Z-debug.log
code/premium-poker-tools [master●] »
这里是 /Users/adamzerner/.npm/_logs/2019-05-27T17_44_07_557Z-debug.log
:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/11.11.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'e2e' ]
2 info using npm@6.9.0
3 info using node@v11.11.0
4 verbose run-script [ 'pree2e', 'e2e', 'poste2e' ]
5 info lifecycle premium-poker-tools@1.0.0~pree2e: premium-poker-tools@1.0.0
6 info lifecycle premium-poker-tools@1.0.0~e2e: premium-poker-tools@1.0.0
7 verbose lifecycle premium-poker-tools@1.0.0~e2e: unsafe-perm in lifecycle true
8 verbose lifecycle premium-poker-tools@1.0.0~e2e: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/adamzerner/code/premium-poker-tools/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/adamzerner/.rvm/bin
9 verbose lifecycle premium-poker-tools@1.0.0~e2e: CWD: /Users/adamzerner/code/premium-poker-tools
10 silly lifecycle premium-poker-tools@1.0.0~e2e: Args: [ '-c', 'node test/e2e/runner.js' ]
11 silly lifecycle premium-poker-tools@1.0.0~e2e: Returned: code: 10 signal: null
12 info lifecycle premium-poker-tools@1.0.0~e2e: Failed to exec e2e script
13 verbose stack Error: premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
13 verbose stack Exit status 10
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:197:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:197:13)
13 verbose stack at maybeClose (internal/child_process.js:984:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid premium-poker-tools@1.0.0
15 verbose cwd /Users/adamzerner/code/premium-poker-tools
16 verbose Darwin 18.6.0
17 verbose argv "/usr/local/Cellar/node/11.11.0/bin/node" "/usr/local/bin/npm" "run" "e2e"
18 verbose node v11.11.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 10
22 error premium-poker-tools@1.0.0 e2e: `node test/e2e/runner.js`
22 error Exit status 10
23 error Failed at the premium-poker-tools@1.0.0 e2e script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 10, true ]
首先,Connection refused! Is selenium server started?
错误似乎是错误的。上面写着 Starting selenium server... started - PID: 58502
,我看到一个 Chrome 浏览器非常短暂地弹出然后立即关闭。
这里是有问题的 before
块的代码:
before(function (browser, done) {
console.log(1);
equityCalculator = browser.page['equity-calculator']();
console.log(2);
equityCalculator.navigate();
console.log(3);
browser.pause(20000);
equityCalculator
.waitForElementVisible('@app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
;
});
我一直在努力查明问题出在哪里,但遇到了很多麻烦。 1
、2
和 3
被注销,但 4
或 5
不会注销,所以这很有帮助。但是,如果 3
被注销,为什么 browser.pause(20000)
不工作?
我也一直在尝试修改我的实际代码以查看问题出在哪里。我在 main.js
中尝试了一些 alert
语句来尝试查明问题:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
alert(1);
window.$ = require('jquery');
require('bootstrap');
alert(2);
import Vue from 'vue';
import store from '@/store';
import App from './App';
import router from './router';
import monkeyPatches from '@/services/monkey-patches';
import axios from 'axios';
import VueAxios from 'vue-axios';
alert(3);
Vue.config.productionTip = false
Vue.use(VueAxios, axios);
axios.interceptors.request.use(
function(config) {
config.withCredentials = true;
return config;
},
function(error) {
return Promise.reject(error);
}
);
/* eslint-disable no-new */
new Vue({
el: '#app',
router: router,
store: store,
template: '<App/>',
components: { App }
});
$(function () {
$('[data-toggle="popover"]').popover();
});
// if (navigator.serviceWorker) {
// navigator.serviceWorker.register('/service-worker.js').catch(function() {
// console.log('Service worker registration failed.');
// });
// }
但奇怪的是,alert(1)
甚至无法正常工作。所以我感到很茫然。据我了解,main.js
的顶部是 Vue 应用程序的 "beginning",如果它甚至没有达到那个点,这是怎么回事? equityCalculator = browser.page['equity-calculator']();
和 equityCalculator.navigate();
看起来很标准。这是页面对象的片段:
module.exports = {
url: 'http://localhost:8080/equity-calculator',
elements: {
'app': '#app',
当我启动我的开发服务器并转到 url 时,一切正常。在我实施用户帐户和身份验证之前,我的端到端测试都运行良好,我没有更改此文件,但现在我遇到了问题。
我不确定我可以从这里去哪里。求助!
更新:
摘自package.json
:
{
...
"dependencies": {
...
"chromedriver": "^2.45.0",
"cross-spawn": "^6.0.5",
"nightwatch": "^0.9.21",
"selenium-server": "^3.141.59",
},
}
这是nightwatch.conf.js
:
require('babel-register')
let config = require('../../config')
// http://nightwatchjs.org/gettingstarted#settings-file
module.exports = {
src_folders: ['test/e2e/specs'],
output_folder: 'test/e2e/reports',
custom_assertions_path: ['test/e2e/custom-assertions'],
page_objects_path: 'test/e2e/page-objects',
globals_path: 'test/e2e/globals.js',
test_runner : 'mocha',
selenium: {
start_process: true,
server_path: require('selenium-server').path,
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': require('chromedriver').path
}
},
test_settings: {
default: {
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
globals: {
devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port),
handStrings: [
'aa', 'aks', 'aqs', 'ajs', 'ats', 'a9s', 'a8s', 'a7s', 'a6s', 'a5s', 'a4s', 'a3s', 'a2s',
'ako', 'kk', 'kqs', 'kjs', 'kts', 'k9s', 'k8s', 'k7s', 'k6s', 'k5s', 'k4s', 'k3s', 'k2s',
'aqo', 'kqo', 'qq', 'qjs', 'qts', 'q9s', 'q8s', 'q7s', 'q6s', 'q5s', 'q4s', 'q3s', 'q2s',
'ajo', 'kjo', 'qjo', 'jj', 'jts', 'j9s', 'j8s', 'j7s', 'j6s', 'j5s', 'j4s', 'j3s', 'j2s',
'ato', 'kto', 'qto', 'jto', 'tt', 't9s', 't8s', 't7s', 't6s', 't5s', 't4s', 't3s', 't2s',
'a9o', 'k9o', 'q9o', 'j9o', 't9o', '99', '98s', '97s', '96s', '95s', '94s', '93s', '92s',
'a8o', 'k8o', 'q8o', 'j8o', 't8o', '98o', '88', '87s', '86s', '85s', '84s', '83s', '82s',
'a7o', 'k7o', 'q7o', 'j7o', 't7o', '97o', '87o', '77', '76s', '75s', '74s', '73s', '72s',
'a6o', 'k6o', 'q6o', 'j6o', 't6o', '96o', '86o', '76o', '66', '65s', '64s', '63s', '62s',
'a5o', 'k5o', 'q5o', 'j5o', 't5o', '95o', '85o', '75o', '65o', '55', '54s', '53s', '52s',
'a4o', 'k4o', 'q4o', 'j4o', 't4o', '94o', '84o', '74o', '64o', '54o', '44', '43s', '42s',
'a3o', 'k3o', 'q3o', 'j3o', 't3o', '93o', '83o', '73o', '63o', '53o', '43o', '33', '32s',
'a2o', 'k2o', 'q2o', 'j2o', 't2o', '92o', '82o', '72o', '62o', '52o', '42o', '32o', '22',
],
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
}
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
}
}
}
}
对于Java/JDK:
code/premium-poker-tools-api [master] » java --version
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
当我查看 Java 控制面板时,它说我是最新的。
我不确定如何确定我使用的是哪个 Selenium 版本或 Chrome 版本。对于 Chrome,如果我打开 Chrome 并转到 "About Google Chrome",它会显示 74.0.3729.169
,这是最新版本,我假设我的测试使用的是相同的版本。
此日志消息...
Starting selenium server... started - PID: 58502
以及随后的错误消息...
Connection refused! Is selenium server started?
...暗示 WebDriver 实例,即 ChromeDriver 虽然启动但无法与 WebBrowsing 通信,即 Chrome session.
关于以下内容的更多详细信息:
- Selenium 版本。
- JDK版本.
- Selenium 服务器 模式 (Standalone/Grid).
- ChromeDriver版本.
- Chrome版本.
本可以帮助我们以更好的方式调试问题。但是,正如您提到的 “1、2 和 3 被注销,但 4 或 5 没有注销”,问题可能源于以下代码块:
equityCalculator
.waitForElementVisible('@app', 50000, function () {
console.log(4);
browser.resizeWindow(1440, 852, function () {
console.log(5);
done();
});
})
原因
根据讨论Connection refused! Is selenium server started nightwatch on edge,您的主要问题似乎是您使用的二进制文件版本之间不兼容。
解决方案
- 将JDK升级到最近的水平JDK 8u212。
- 将 Selenium 升级到当前水平 Version 3.141.59。
- 将ChromeDriver升级到ChromeDriver v74.0级别。
- 将Chrome版本升级到Chromev74级别。 (as per ChromeDriver v74.0 release notes)
- 通过 IDE 和 重建你的项目只需要依赖。
- 如果您的基本 Web Client 版本太旧,则卸载它并安装最新的 GA 和发布版本的 Web Client。
- 系统重启。
- 执行你的
@Test
. - 始终在
tearDown(){}
方法中调用driver.quit()
来关闭和销毁 WebDriver 和 Web Client 实例优雅。
结尾
分辨率
updating
npm 解决了这个问题(根据 OP 的评论)
npm update