我们有一个应用程序,并在本地测试它显示无效的SSL证书警告。通常我会添加一个异常并继续使用它。然而,量角器无论如何都会忽略这一点?
我已经在selenium中看到了一些可以忽略SSL但在量角器中似乎无法找到的功能。
答案 0 :(得分:5)
这对我有用,(在conf文件中):
capabilities: {
browserName : 'firefox',
marionette : true,
acceptInsecureCerts : true
}
希望有所帮助。
答案 1 :(得分:0)
尝试
webdriver-manager update --ignore_ssl
或为firefox配置protractor.conf.js
var makeFirefoxProfile = function(preferenceMap) {
var profile = new FirefoxProfile();
for (var key in preferenceMap) {
profile.setPreference(key, preferenceMap[key]);
}
return q.resolve({
browserName: 'firefox',
marionette: true,
firefox_profile: profile
});
};
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
framework: 'jasmine2',
getMultiCapabilities: function() {
return q.all([
makeFirefoxProfile(
{
'browser.acceptSslCerts': true
}
)
]);
},
}
答案 2 :(得分:0)
capabilities: {
browserName: 'chrome',
chromeOptions: {
// for ci test
args: ['--headless', 'no-sandbox', "--disable-browser-side-navigation",
"--allow-insecure-localhost"
/// for https sites: ignore ssl on https://localhost...
/// further args please see https://peter.sh/experiments/chromium-command-line-switches/
]
}
}
也许您想拍一些屏幕截图来测试错误发生的位置
import fs from 'fs';
function writeScreenShot(data, filename) {
const stream = fs.createWriteStream(filename);
stream.write(new Buffer(data, 'base64'));
stream.end();
}
export function takeScreenshot(browser, path){
browser.takeScreenshot().then((png) => {
writeScreenShot(png, path);
});
}