Monday, 7 August 2017

Code Example - IE Untrusted Connection

package com.seleniumWebdriver;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

/**
 * @Blog Name : Selenium Code Example
 * @author Deepak Gupta
 * @Created Date 7-08-2017
 *
 */
public class IEUntrustedConnection {

WebDriver driver;
String url = "Enter your url";

@Test
public void HandleIEUntrustedConnection() {

System.setProperty("webdriver.ie.driver", "./Browser_Driver/IEDriverServer.exe");
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new InternetExplorerDriver(dc);
driver.get(url);
String js = "javascript:document.getElementById('overridelink').click();";
driver.navigate().to(js);
}

@AfterClass
public void end() throws InterruptedException {
Thread.sleep(2000);
driver.quit();
}

}

No comments:

Post a Comment

Code Example - File Download By Robot Class In Firefox Browser

Exported from Notepad++ package com . practiceCode ; import java . awt . AWTException ; import java . awt . Robot ; import j...