浏览器证书
Firefox
Firefox 驱动程序默认情况下会正确处理不受信任的证书。
如果您拥有受信任的证书,但存在其他证书错误,例如主机名不匹配(例如,在测试中使用生产证书),您应该执行以下操作
profile = Selenium::WebDriver::Firefox::Profile.new
profile.assume_untrusted_certificate_issuer = false
b = Watir::Browser.new :firefox, profile: profile
需要这样做的原因在 这里 解释。
Chrome
通过传递命令行开关,可以轻松忽略 Google Chrome 中的无效浏览器证书
Watir::Browser.new :chrome, switches: ['--ignore-certificate-errors']