我正在使用selenium.js做一个测试,它是使用WebdriverIO和Node.js编写的。运行测试时,出现错误"driver.version: unknown"
。
我已经验证了我的系统PATH变量和chrome驱动程序版本。但是找不到根本原因。
selenium.js:
var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
webdriverio
.remote(options)
.init()
.url('http://www.google.com')
.getTitle().then(function(title) {
console.log('Title was: ' + title);
})
.end()
.catch(function(err) {
console.log(err);
});
错误:
{ Error: A new session could not be created.
at end() - C:\Projects\Testing_Tool_Evaluation\my-first-react-test\selenium.js:15:6
details: undefined,
message: 'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.13.0\', revision: \'2f0d292\', time: \'2018-06-25T15:32:19.891Z\'\nSystem info: host: \'SUARUMG-IN-LE01\', ip: \'10.0.75.1\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_161\'\nDriver info: driver.version: unknown',
type: 'RuntimeError',
seleniumStack:
{ type: 'SessionNotCreatedException',
message: 'A new session could not be created.',
orgStatusMessage: 'Unable to create new service: ChromeDriverService\nBuild info: version: \'3.13.0\', revision: \'2f0d292\', time: \'2018-06-25T15:32:19.891Z\'\nSystem info: host: \'SUARUMG-IN-LE01\', ip: \'10.0.75.1\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'1.8.0_161\'\nDriver info: driver.version: unknown' } }
运行测试后,我可以在硒服务器中观察到以下功能
Capabilities are: {
"browserName": "chrome",
"handlesAlerts": true,
"javascriptEnabled": true,
"locationContextEnabled": true,
"loggingPrefs": {
"browser": "ALL",
"driver": "ALL"
},
"requestOrigins": {
"url": "http:\u002f\u002fwebdriver.io",
"version": "4.13.0",
"name": "webdriverio"
},
"rotatable": true
}