【发布时间】:2016-06-27 19:54:57
【问题描述】:
我需要能够使用以下 arg 运行 phantomjs:
--ignore-ssl-errors=true
我正在测试的页面使用自签名证书,因此我需要 arg 来打开页面。我正在尝试使用下面的 sn-p 在 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);
}
【问题讨论】:
标签: javascript selenium-webdriver phantomjs