Technical Project Lead @ Huawei Technologies

My photo
Bangalore/Hyderabad, Karnataka/Andhra Pradesh, India
Have an overall 13 + yrs of experience Currently working as an Senior Architect.Expertise in design,implementation of Automation frameworks for Opensource automation tools like Selenium,Jmeter, Webdriver,Appium, Robotium Expertise in integrating Test & ALM Management tools like Rally,Qmetry,JIRA-Zephyr with Automation frameworks Expertise in design and developmenet Mobile Automation frameworks for tools like Appium, Robotium Remote Control,Cucumber BDD,Manual Testing

Followers

Thursday, September 2, 2010

How to Supress/accept SSL certificates using Selenium

Just follow 2 steps to make selenium accept the SSL certificated
1. Start your Selenium RC server using the following command
java -jar selenium-server.jar -trustAllSSLCertificates

For Firefox
2. use firefoxproxy instead of *firefox

For Internet Explorer
2. use iexploreproxy instead of *iexplore

An extra step is required for proxying SSL content with Internet Explorer. Selenium bundles a special certification authority (CA) certificate that is used to trust all the other SSL certificates.

Installing the CyberVillains Certificate on Windows

The CyberVillains certificate is bundled in the most recent Selenium RC releases in SSLSupport folder. If you download the distribution and extract it, you should be able to get going starting with Figure 1. In the explorer address bar in Figure 1 you can see where to find the certificate.










                                          Figure 1 

Double-click the CyberVillains certificate in the selenium server distribution(Refer above Image)

Click on Install Certificate Button

Click on Next Button

Select the radio button "Place all certificates in the following store"

Select Trusted Root CertificationAuthorities folder

Click on Finish button

Accept Security warning


15 comments:

  1. this is one of the best guides to installing ssl certificates i have come accross, the visual guide is very helpful for those who are less technical.

    ReplyDelete
  2. Thanks kiran, for this wonderfull post on installing ssl certificate. It worked out well for me. I request you to help me in solving this problem. Instead of running

    selenium server in cmd prompt using "-trustAllSSLCertificates" parameter, is it possible to start the selenium server with "-trustAllSSLCertificates" parameter in

    eclipse code. I tried it with the code below, but its not working. I still get the certification error when I run my script. The code snippet is given below

    public class netTeller2 {
    private static final String BASE_URL = "https://www.google.com";
    private Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefoxproxy", BASE_URL);
    private SeleniumServer seleniumServer;

    @BeforeClass

    public void setUp() throws Exception
    {
    RemoteControlConfiguration rc = new RemoteControlConfiguration();
    rc.trustAllSSLCertificates();
    seleniumServer = new SeleniumServer(rc);
    seleniumServer.start();
    selenium.start();
    selenium.windowMaximize();
    selenium.windowFocus();
    selenium.setTimeout("60000");
    }

    ReplyDelete
  3. Thanks a ton, kiran... I got the answer for my question in one of your other posting, http://kirankanumuri.blogspot.com/2010/09/programatically-starting-selenium.html

    ReplyDelete
  4. Hi Kiran,
    The description is nice.However,the recent Selenium RC 2.2.0 comes alone with a jar file.I tried to start the server with -trustAllSSLCertificates but failed. Could you please tell me elaborately how to achive this with a successful installation of SSL certificates?

    Thanks
    Alok

    ReplyDelete
  5. Hi Kiran its really good but is not working for firefox for me. Any idea.

    ReplyDelete
    Replies
    1. Which version of FF are you using ?

      Delete
    2. Where should I mention use "firefoxproxy instead of *firefox" ??? Please tell me

      Delete
  6. The best and simple tutorial..........great....It works fine for me...

    ReplyDelete
  7. Hi Kiran,

    thanks for your manual. it helps me, when I start my test from Eclipse. I also tried run all test by maven. I still have problem run it in IE (window is open, but with error that pop up is maybe enabled - is not). When i tried it open by firexor, it still ask for me accpet security certificates. can you help me with my problem? Do you have some experience with it? Thanks a lot. Zuzi

    ReplyDelete
  8. Is there any difference between Left click and Right ? How to Handle Right click Menu options with Selenium RC?

    ReplyDelete
  9. I got an automation for validate broken links, but Selenium with java throw me this error all the time:

    javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No name matching XXX.XXXXXX.XXXX found.

    And I implement my server and selenium like this:

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

    SeleniumServer server = new SeleniumServer(rcc);

    server.start();

    selenium = new DefaultSelenium("localhost", 4444, "*firefoxproxy", "https://mypage.com");

    The page of the certificate do not appear, but when Selenium go to validate the first link, sent me that error and the progrm ends.

    Could you please Help me?


    ReplyDelete
  10. I have an issue with the cybervillains certificate. I am using selenium-server-standalone-2.28.0.jar. I have installed certificate on Windows 7, Fedora Linux, Windows Xp. However, the certificate is working on Windows 7 and Fedora Linux. In Windows Xp, the certificate is unable to open https sites on Google Chrome 24 browser.

    The Error logged is untrusted site, please provide proper certificate.

    Is there any changes to be made on the browser side to make https sites work.

    Please provide workarounds. Thanks in advance.

    ReplyDelete
  11. does anybody know how it works with Selenium Webdriver and Java?

    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    seems not to work.

    ReplyDelete
  12. Erna Tercero, for validation of broken links I would recommend this API 'LinkChecker' https://code.google.com/p/linkchecker/.Use this api and make calls with in your Selenium or Java code.

    ReplyDelete
  13. Great blog..

    Thanks for Sharing this useful information amazing blog, It's help to know about the Selenium Certification and importance of Selenium ...

    ReplyDelete