不安装Java,是否有可能使用Nightwatch.js? 官方的Selenium JavaScript绑定(WebDriverJS, selenium-webdriver)。 为什么需要Java呢?
不安装Java,是否有可能使用Nightwatch.js? 官方的Selenium JavaScript绑定(WebDriverJS, selenium-webdriver)。 为什么需要Java呢?
selenium": {
"start_process": true,
"server_path": "lib/selenium-server-standalone-2.53.0.jar",
"cli_args" : {
"webdriver.chrome.driver" : "/Users/greg.kedge/bin/chromedriver"
},
"log_path": "integration/log" }
% chromedriver --url-base=/wd/hub
Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 9515
Only local connections are allowed.
"test_settings": {
"default": {
"launch_url": "http://localhost:8888/",
"selenium_host": "127.0.0.1",
"selenium_port": "9515",
"silent": true,
"firefox_profile": false,
"screenshots": {
"enabled": false,
"path": ""
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"__commentOut: chromeOptions" : {
"args" : ["start-fullscreen"]
}
},
}
}
现在官方网站上有关于如何操作的文档。
我在配置过程中遇到了一些问题,所以我创建了一个带有可工作代码的样例存储库:
有:
在global.js
文件中指定以下内容:
const chromedriver = require('chromedriver');
module.exports = {
before: function (cb) {
chromedriver.start();
cb();
},
after: function (cb) {
chromedriver.stop();
cb();
},
前往 nightwatch.conf.js
文件并在其中指定全局路径
这样,你的 Selenium 就会通过 Chromedriver 转接,而无需在你的机器上安装 Selenium。