当我使用这个简单的测试脚本时,chromedriver.exe
会留在内存中。
简单test.js
module.exports = {
'Test url': function (browser) {
browser
.url('http://www.google.com')
.waitForElementVisible('body', 5000)
.expect.element('input[name=q]').to.be.visible
browser.end()
}
};
Nightwatch.js配置文件
const chromedriverPath = require('chromedriver').path;
const geckodriverPath = require('geckodriver').path;
const seleniumServerPath = require('selenium-server').path;
const now = Date.now()
module.exports = {
output_folder: 'tests/reports',
selenium: {
start_process: true,
log_path: 'tests',
server_path: seleniumServerPath,
cli_args: {
'selenium.LOGGER.level': 'FINEST',
'webdriver.chrome.driver': chromedriverPath,
'webdriver.chrome.verboseLogging': 'true',
'webdriver.chrome.logfile': 'tests\\chromedriver-' + now + '.log',
'webdriver.gecko.driver': geckodriverPath,
},
},
test_settings: {
default: {
globals: {
url: 'http://localhost:1337'
},
desiredCapabilities: {
browserName: 'chrome',
},
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
},
},
},
};
输出显示没有错误,但chromedriver.exe
永远不会终止,我要杀死它。难道我做错了什么 ?
注意:我在Window 10 Pro 64位上使用Nightwatch.js v0.9.21和chromedriver v2.41.578737
注2:selenium中的等效脚本没有表现出这种行为,chromedriver在browser.quit()
之后关闭了自己。
通过将我的项目迁移到夜视仪1.0.6(测试版)(+ nightwatch-api 0.4.0)来解决