Selenium With Java and Python For Mobile Apps & Web Apps......!

Wednesday, 8 April 2015

How to handle SSL certificate in Mozilla,Chrome and Internet Explorer or How to work with Https websites .

Mozilla:

FirefoxProfile profile = new FirefoxProfile();

profile.setAssumeUntrustedCertificateIssuer(false);

driver = new FirefoxDriver(profile);

driver.get("https://google.com/ <https://mailbox.com/> ");


Chrome:

DesiredCapabilities capabilities = new DesiredCapabilities();

    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    System.setProperty("webdriver.chrome.driver", "D:\\Softwares\\Selenium 

softwares\\drivers\\chromedriver.exe");

    _driver = new ChromeDriver(capabilities);

    System.setProperty("webdriver.chrome.driver",

            "D:/Softwares/Selenium softwares/drivers/chromedriver.exe");

    //_driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);

Internet Explorer :

System.setProperty("webdriver.ie.driver",

    "D:/Softwares/Selenium softwares/drivers/IEDriverServer.exe");

    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();    

capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_B

Y_IGNORING_SECURITY_DOMAINS, true); 

    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    capabilities.setJavascriptEnabled(true); 

    //capabilities.setCapability("chrome.switches", Arrays.asList("--ignore-

certificate-errors"));

    _driver = new InternetExplorerDriver(capabilities);

    _driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);


    login();

    

0 comments:

Post a Comment

Translate

Popular Posts

Total Pageviews