1

由于第三方脚本加载了非 HTTPS 资源(最初它们很好,但它们偶尔会改变),我们偶尔会在页面中看到 SSL 证书受损。我们想每天测试这些页面是否有损坏的 SSL。

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

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

4

1 回答 1

1

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.

于 2013-03-04T15:43:28.593 回答