如何使用Selenium检测页面上的SSL是否已损坏 [英] How do I detect that SSL is broken on a page, using Selenium

查看:126
本文介绍了如何使用Selenium检测页面上的SSL是否已损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于第三方脚本加载了非HTTPS资源,我们偶尔会看到被盗用SSL证书的页面(最初它们很好但偶尔也会更改)。我们希望每天都测试这些页面是否存在损坏的SSL。

We have pages where we occasionally see compromised SSL certificate because of third party scripts that load non HTTPS resources (Initially they're fine but they occasionally change). We would like to test those pages for broken SSL every day.

我们尝试了一种方法,尝试捕获弹出消息,表明我们有不安全的内容在页面上。但是,我们在通过selenium模拟弹出消息方面没有成功。似乎selenium已自动禁用任何弹出窗口。虽然我们已经确定了一个Selenium方法来禁用弹出窗口的禁止(disable-popup-handler),但是即使使用这种方法我们也无法成功看到弹出窗口。

We have tried one approach, attempting to catch a pop-up message that would indicate that we have insecure content on the page. However, we have been unsuccessful in simulating the pop-up message through selenium. It appears that selenium has automatically disabled any popups. While we have identified a Selenium method to disable the suppression of the pop-ups(disable-popup-handler) but we have not been able to successfully see the popup even using this method.

有没有人找到使用Selenium检测损坏的SSL页面的方法?

Has anyone found a way to detect broken SSL pages using Selenium?

推荐答案

您需要加载浏览器配置文件(使用WebDriver)没有启用弹出窗口阻止程序的设置(使用Profile类并为其提供正确的属性)。然后,您将获得有关SSL证书的Windows弹出消息。如果由于某种原因,您无法使用WebDriver控制弹出窗口(因为它仅限于浏览器内容窗口中的Action控件),那么您可以使用Sikuli API来处理对话框并将证书导出到下载目录然后复制文件到预期的检查位置。不幸的是,如果你使用Sikuli,那将使你的自动化脚本顺序而不能通过RemoteWebDriver网格服务器工作,因此你将无法运行并行测试。有条不紊地,WebDriver允许您访问对话框,因此您可以使用RemoteWebDriver运行,因为这是运行脚本时的最佳方式,即使您在本地运行浏览器也是如此。

You need to load a browser profile (with WebDriver) that doesn't have the setting for popup blocker enabled (using the Profile class and giving it the right properties). Then, you will get the Windows popup message concerning the SSL cert. If , for some reason, you cannot control the popup using WebDriver (because its limited to Action control only within the browser content window) then you can use Sikuli API to handle the dialog and export the cert to the "Downloads" dir and then copy the file to expected location for inspection. Unfortunately, if you use Sikuli, that will make your automation script sequential and not work via a RemoteWebDriver grid server and so you wont be able to run parallel tests. Hopfully, WebDriver gives you access to the dialog and so you will be able to run with RemoteWebDriver because that is the best way to go when running scripts, even if you run a browser locally.

这篇关于如何使用Selenium检测页面上的SSL是否已损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆