Friday, May 23, 2014

How do you handle https website in selenium ?

Ans- By changing the setting of FirefoxProfile.
 
ex-
public class HTTPSSecuredConnection {
            public static void main(String[] args){
                        FirefoxProfile profile = new FirefoxProfile();
                        profile.setAcceptUntrustedCertificates(false);
                        WebDriver driver = new FirefoxDriver(profile);
                        driver.get("https://184.106.253.74");
}
}

4 comments:

  1. Hi Sanjay..

    Can you please explain, why we need to set 'setAcceptUntrustedCertificates' to false here? Is handling of 'https' website different from the other websites(say gmail,facebook so on..)?

    ReplyDelete
  2. yes to handle https website.
    you try to set 'setAcceptUntrustedCertificates' to true, it will not open that https website.

    ReplyDelete
  3. Good going Mr Sanjay

    Regards,
    Lakshay Sharma

    ReplyDelete
  4. Even if i use true.. it still works

    ReplyDelete