如何为Java PhantomJSDriver指定命令行参数?例如,我想在我运行的脚本上设置--ignore-ssl-errors=yes
。
答案 0 :(得分:5)
只需添加到phantomJS的默认所需功能,如下所示:
DesiredCapabilities desiredCapabilities = DesiredCapabilities.phantomjs();
desiredCapabilities.setCapability("phantomjs.cli.args", Collections.singletonList("--ignore-ssl-errors=yes"));
PhantomJSDriver driver = new PhantomJSDriver(desiredCapabilities);