我正在使AngularJS网站自动化,并且我需要在Protractor无头的情况下运行Selenium Chrome Driver。问题是我在终端中收到此错误:
Mixed Content: The page at 'https://x.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://y.com'. This request has been blocked; the content must be served over HTTPS.
我尝试在下面的代码中使用一些Chrome args,但未成功。但是,如果删除无头的arg,它就可以工作。
capabilities: {
browserName: 'chrome',
acceptInsecureCerts : true,
acceptSslCerts : true,
chromeOptions: {
args: [
'--headless',
'--disable-gpu',
'--remember-cert-error-decisions',
'--ignore-certificate-errors',
'--reduce-security-for-testing',
'--allow-running-insecure-content',
'--window-size=800,600'
]
},
},
答案 0 :(得分:0)
https://github.com/angular/protractor/blob/master/docs/browser-setup.md#using-headless-chrome
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
}
}
上面三个args足以在无头模式下运行。
尝试删除功能中的其他参数
答案 1 :(得分:0)
我遇到了同样的问题。解决方案是单击浏览器中URL右侧的“屏蔽”图标,然后单击“加载不安全脚本”