Jenkins 如何访问没有安全证书的网站?

How could Jenkins access to a website without security certificates?

我需要 运行 一个基于 Selenium IDE 的脚本。此脚本 运行s 在测试站点上。此网站没有安全证书,当我第一次进入此网站时出现此屏幕:

First Image

所以我必须添加安全证书,单击 "Añadir Excepcion"(添加例外)link。而且这个验证不会再出现了。

但是当我 运行 Jenkins 上的 Selenium 脚本时,这是测试套件的结果:

Second Image

我认为这是因为 Jenkins/Selenium Server.jar 由于认证验证无法访问该网站。有人可以告诉我这是正确的还是不正确的,如果它是正确的,我怎么能 "jump" 或逃避此验证。

SOLUTION:

Add the -trustAllSSLCertificates command in Jenkins.

Selenium 只能与显示的网页中的 DOM 对话。显示的有关网页证书的警报是由浏览器发出的,不是网页的一部分。如果你只能使用 Selenium IDE 而你不能使用明显的解决方法(手动打开 URL 并告诉浏览器接受它,然后 运行 测试),那么你似乎被卡住。

如果您使用 Java 或 Python 等其他语言编写 Selenium Webdriver 调用,则可以使用名为 Sikuli 的库来匹配并单击屏幕上的图标。让 Sikuli 检测安全警报并单击正确的东西,然后返回 Selenium Webdriver 调用来戳网站。

有可用的解决方法。 https://saucelabs.com/resources/selenium-totw-https-and-self-signed-certificate-exceptions

The workaround for this problem is to create your own Firefox profile, with the specific certificate added on it by hand, and then tell Selenium to launch the browser based on that profile.

Another interesting approach - the one we take at Sauce Labs, where we can’t do this kind of trick, because we just don’t know which certificate the user will need before the test starts - is to use the RCE (Remember Certificate Exception). This is a plugin that will automatically detect the warning and make the browser go through it, returning control to Selenium after 4 or 5 seconds. Notice that if you use this approach, you will need to make sure your tests will tolerate this five-second additional delay before opening the page.