設置service_args我需要能夠運行具有以下ARG phantomjs:在硒的webdriver phantomjs節點
--ignore-SSL-錯誤=真
我測試使用頁面一個自簽名證書,所以我需要arg打開頁面。我試圖通過使用下面的代碼片段中的webdriver的ARG:
capabilities = webdriver.Capabilities.phantomjs();
capabilities.set('service_args', '--ignore-ssl-errors=true');
driver = new webdriver.Builder().
withCapabilities(capabilities).
build();
是傳遞service_args正確的方法是什麼?我其實希望沒有,因爲我無法加載我的測試頁面。我可以通過運行打開網頁:
phantomjs --ignore-ssl-errors=true myTest.js
這裏是myTest.js代碼
var page = new WebPage();
page.open('https://my.somefaketestpage.com/', function (status) {
just_wait();
});
function just_wait() {
setTimeout(function() {
page.render('screenshot.png');
phantom.exit();
}, 2000);
}