Selenium HTTPS上的PhantomJS

Selenium HTTPS上的PhantomJS,selenium,ssl,https,phantomjs,protractor,Selenium,Ssl,Https,Phantomjs,Protractor,我需要使用PhantomJS为使用https的站点运行量角器测试。这是一个开发环境,证书是自签名的,不被PhantomJS识别。我用--ignoresslerrors标志启动PhantomJS,这应该使它接受无效证书,但这不起作用。在CLI中: phantomjs--webdriver=localhost:4444--web security=false--ignore ssl errors=true--ssl protocol=any 尽管有这些设置,webdriver的acceptSslCe

我需要使用PhantomJS为使用https的站点运行量角器测试。这是一个开发环境,证书是自签名的,不被PhantomJS识别。我用--ignoresslerrors标志启动PhantomJS,这应该使它接受无效证书,但这不起作用。在CLI中:

phantomjs--webdriver=localhost:4444--web security=false--ignore ssl errors=true--ssl protocol=any

尽管有这些设置,webdriver的acceptSslCerts属性仍然设置为false。从日志中:

Session.negotiatedCapabilities-{“browserName”:“phantomjs”,“版本”:“2.1.1”,“driverName”:“ghostdriver”,“driverVersion”:“1.2.0”,“平台”:“mac-unknown-64位”,“javascriptEnabled”:true,“takesScreenshot”:true,“handlesAlerts”:false,“databaseEnabled”:false,“locationContextEnabled”:false,“ApplicationCachEnabled”:false,“browserConnectionEnabled”:false,“CSSSelectorEnabled”:true,“WebStorage Enabled”:false,“rotatable”:false,“acceptSslCerts”:false,“nativeEvents”:true,“proxy”:{“proxyType”:“direct”}

在相关的GhostDriver回购问题()中,列出了以下代码:

const capabilities=webdriver.capabilities.phantomjs();
capabilities.set(webdriver.Capability.ACCEPT_SSL_CERTS,true);
capabilities.set(webdriver.Capability.SECURE_SSL,false);
capabilities.set('phantomjs.cli.args',['--web security=no','--ssl protocol=any','--ignore ssl errors=yes']);
const driver=new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome(),Capabilities.build();

我试着在dragrator.conf.js中设置:

功能:{
browserName:“幻影”,
“webdriver.Capability.ACCEPT_SSL_CERTS”:true,
“webdriver.Capability.SECURE\u SSL”:false
}

但这没有效果


有人知道如何在https模式下运行PhatomJS吗?

我目前面临着同样的问题。尝试了所有您告诉的替代方案,但似乎没有任何效果

唯一有效的方法(对我的项目不可行,但对你的项目可能有效)是实例化webdriver并传递服务参数,如下所示:

Python:

webdriver.PhantomJS(executable_path='/home/rodrigo/bin/phantomjs-2.1.1-linux-x86_64/bin/phantomjs',
                    desired_capabilities=dict(DesiredCapabilities.PHANTOMJS),
                    service_args=['--web-security=no', '--ssl-protocol=any', '--ignore-ssl-errors=yes'])

希望它对你的帮助大于对我的帮助。

我目前面临着同样的问题。我尝试了你告诉我的所有替代方案,但似乎没有任何效果

唯一有效的方法(对我的项目不可行,但对你的项目可能有效)是实例化webdriver并传递服务参数,如下所示:

Python:

webdriver.PhantomJS(executable_path='/home/rodrigo/bin/phantomjs-2.1.1-linux-x86_64/bin/phantomjs',
                    desired_capabilities=dict(DesiredCapabilities.PHANTOMJS),
                    service_args=['--web-security=no', '--ssl-protocol=any', '--ignore-ssl-errors=yes'])
希望它对你的帮助大于对我的帮助