在 Firefox 中添加安全例外
我有一个运行 watir-webdriver(使用 Firefox 4.0)的脚本,需要访问 Firefox 认为具有无效证书的网页。
问题是,在我接受证书后,Firefox 会直接返回同一页面,就好像我从未接受过它一样。
仅当 Firefox 从 watir-webdriver 启动时才会出现这种情况。如果我手动启动它,它将正确接受安全异常。
I have a script running watir-webdriver(using Firefox 4.0) that needs to access a web page that Firefox thinks has an invalid certificate.
The problem is that after I accept the certificate, Firefox just goes right back to the same page as if I never accepted it.
This only occurs if Firefox was started from watir-webdriver. If I start it manually, it will properly accept the security exception.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Firefox 驱动程序为每个实例创建一个新的匿名配置文件,因此它可以在您的默认配置文件中工作,但不能与 WebDriver 一起工作,这并不奇怪。
WebDriver 通常非常擅长处理证书问题,但有一个边缘情况:您提供的有效证书与所提供的主机名不匹配(例如测试环境中的生产证书)。如果是这种情况,您需要在 Firefox 配置文件中设置一个标志:
如果这没有帮助,您也可以仅使用默认配置文件作为模型:
The Firefox driver creates a new anonymous profile for each instance, so that it's working in your default profile but not with WebDriver isn't that suprising.
WebDriver is usually pretty good at dealing with certificate issues, but there is an edge case: you're serving a valid certificate that doesn't match the host name it's served from (e.g. production certificates in a test environment). If that's the case, you'll want to set a flag in the Firefox profile:
If that doesn't help, you can also just use your default profile as a model:
您是否尝试过转到“工具”->“选项”->-“高级”->“加密”选项卡
然后单击验证按钮并取消选中使用在线证书状态协议 (OCSP) ...
您可以使用 Selenium 的 Ruby 绑定以编程方式禁用此功能
例如
Have your tried going to Tools->Options->-Advanced->Encryption Tab
Then click the Validation button and uncheck use the Online Certificate Status Protocol (OCSP) ...
You can disable this programatically with the Ruby bindings for Selenium
e.g.