2011-03-22 102 views
8

当使用Selenium进行自动化时,有什么办法可以抑制在HTTPS上访问网站时显示的警告?我遇到了“-trustAllSSLCertificates”这个选项,但是我无法工作。我以下列方式启动了我的Selenium服务器:当使用Selenium进行自动化时,抑制Firefox中的SSL安全警告

java -jar selenium-server.jar -trustAllSSLCertificates 

...但我仍然收到安全警告。我是否错过了其他一些步骤?

+0

我认为这是你在找什么:http://stackoverflow.com/questions/12082052/how-can-i-get-webdriver-to-dismiss-a -firefox-security-alert – Alex 2013-02-04 18:12:31

回答

6

刚刚工作。方法如下:

除了使用-trustAllSSLCertificates选项启动Selenium服务器之外,Selenium启动的浏览器还应配置为使用Selenium服务器作为其代理。

例如:如果Selenium服务器在默认端口4444的主机myselenium.mycompany.com处启动,则代理设置为myselenium.mycompany.com:4444。一种实现自动化的方法是创建一个Firefox配置文件并将代理配置为该地址和端口,并在使用-firefoxProfileTemplate选项启动Selenium服务器时将该创建的配置文件作为参数传递。

java -jar selenium-server.jar -trustAllSSLCertificates -firefoxProfileTemplate /path/to/selenium_profile 
+0

是否有任何想法如何处理IE中的相同问题与PHP我已经搜索了很多关于此请帮助。 – lAH2iV 2011-09-08 09:26:37

4

使用Selenium RC服务器2.X(指版本2+),然后运行命令

Java的罐子硒的服务器独立-2.XXjar -trustAllSSLCertificates

这是对于肯定的工作

0

我正在寻找一个编程方式来做到这一点,我有一个很好的方式来做到这一点,完全符合我的自动化框架。下面是我做的:

//==========Create a RC Configuratoion object and Set trust all SSL certs to true========== 

RemoteControlConfiguration rcc = new RemoteControlConfiguration(); 
rcc.setTrustAllSSLCertificates(true); 

//====Create a SeleniumServer object using the configuration===================== 
SeleniumServer serv = new SeleniumServer(rcc); 
serv.start