考慮到這些節點的依賴性:如何讓selenium-webdriver忽略Firefox和PhantomJS中的SSL錯誤?
{
"chromedriver": "^2.24.1",
"cucumber": "^1.3.0",
"geckodriver": "^1.1.2",
"phantomjs-prebuilt": "^2.1.12",
"selenium-webdriver": "^3.0.0-beta-2"
}
我想PhantomJS和Firefox忽略SSL證書。以下是我的browser.js的外觀:
require('geckodriver');
// main browser object
var browserHandle;
// load selenium webdriver and some rules
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
// load phantomjs into webdriver capabilities
var phantomjs_exe = require('phantomjs-prebuilt').path;
var customPhantom = webdriver.Capabilities.phantomjs();
customPhantom.set("phantomjs.binary.path", phantomjs_exe);
webdriver.Builder()
//.forBrowser('firefox')
//.forBrowser('phantomjs')
.withCapabilities(customPhantom)
.build();
任何建議與--ignore-ssl-errors=yes
?我如何在代碼中實現它?我只想使用JavaScript,而不是Java。
超好用感謝 –
僅供參考,我發現,這是足夠寫'capabilities.set( 「phantomjs.cli.args」,[「 - -ignore-ssl-errors = yes「]);'讓PhantomJS加載一個不受信任的證書。 – Chris
@Chris真棒 – 6axter82