Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress SSL security warning in Firefox when using Selenium for automation

Is there a way to suppress the warning displayed when accessing sites on HTTPS when using Selenium for automation? I came across the option "-trustAllSSLCertificates", but I wasn't able to get it working. I started my Selenium server the following way:

java -jar selenium-server.jar -trustAllSSLCertificates

... but I still got the security warning. Am I missing some other steps?

like image 320
Srikanth Avatar asked Mar 22 '11 12:03

Srikanth


People also ask

How does Selenium handle SSL certificate in Firefox?

We can handle SSL certificate in Firefox with the help of the Selenium webdriver by using the FirefoxProfile class. Then setting the parametersetAcceptUntrustedCertificates to true. A SSL is a protocol followed to create a secure connection between the client (browser) and the server.

Can we resolve the SSL certificate issue in Selenium?

As we have mentioned that sometimes the firefox profile doesn't have the certificate. That's why we are getting the SSL: certificate error. SO to resolve this issue, we can create a Firefox profile manually, and after that, we can use the same profile with our selenium webdriver.


2 Answers

Just got it working. Here's how:

In addition to starting the Selenium server with -trustAllSSLCertificates option, the browser that is being launched by Selenium should be configured to use the Selenium server as its proxy.

For example: If Selenium server is started at host myselenium.mycompany.com at the default port 4444, the proxy setting is myselenium.mycompany.com:4444. One way to do automate this is to create a Firefox profile and configure the proxy to this address and port, and pass this created profile as an argument when starting the Selenium server using -firefoxProfileTemplate option.

java -jar selenium-server.jar -trustAllSSLCertificates -firefoxProfileTemplate /path/to/selenium_profile
like image 199
Srikanth Avatar answered Oct 01 '22 06:10

Srikanth


Use Selenium RC Server 2.X (means version 2+), and run the command

java -jar selenium-server-standalone-2.X.X.jar -trustAllSSLCertificates

It is For sure working

like image 20
Romal arora Avatar answered Oct 01 '22 06:10

Romal arora