top of page
  • Writer's picturekhyati sehgal

How to deal with Internet Explorer issues to make it work via Selenium.

To err is human, well said.

I have been traversing over web what all new things I can explore and share knowledge about, but I can never deny the fact that there is a lot which I can share and talk about. Today I will share how Selenium faces problem while connecting with Internet Explorer. Lets get started then.

How to use Internet Explorer?

Selenium provided support to Firefox, by default. This is something which the Selenium-creators have done to make our life easier while working with FireFox. Now, how about browsers other than default. Of-course, they understand that Web-UI testing can not be said as completed if it is not tested well on multiple browsers.

For testing your application on Internet Explorer via Selenium, you need to add the internetExplorer.exe into your project. And use this for the invocation of the browser,like this:


public void initDriver(){
try{
if(Property.IsRemoteExecution.equalsIgnoreCase("true")){
String remoteURL;
DesiredCapabilities capabilities = new DesiredCapabilities();
if(Property.RemoteURL.toLowerCase().contains("saucelabs")){
//set all saucelab capabilities here.
}
remoteURL = Property.RemoteURL + "/wd/hub";

URL uri = new URL(remoteURL);
if(browserName.equalsIgnoreCase("firefox")){
FirefoxProfile remoteProfile = new FirefoxProfile();
remoteProfile.setPreference("webdriver_assume_untrusted_issuer", false);
remoteProfile.setAcceptUntrustedCertificates(true);
remoteProfile.setEnableNativeEvents(false);
capabilities.setBrowserName("firefox");
capabilities.setCapability("firefox_profile", remoteProfile.toString().toString());
driver = new RemoteWebDriver(uri, capabilities);
}
else if(browserName.equalsIgnoreCase("internetexplorer")){
capabilities.setBrowserName("internet explorer");
capabilities.setCapability("ignoreProtectedModeSettings", true);
driver = new RemoteWebDriver(uri,capabilities);
}

}
else{
if(browserName.equalsIgnoreCase("firefox")){
FirefoxProfile ffprofile = new FirefoxProfile();
ffprofile.setPreference(
"webdriver_assume_untrusted_issuer", "false");
driver = new FirefoxDriver(ffprofile);
}
else if(browserName.equalsIgnoreCase("internetexplorer")){
DesiredCapabilities iecapabilities = DesiredCapabilities
.internetExplorer();
iecapabilities.setCapability("ignoreProtectedModeSettings",
"true");
iecapabilities
.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
"true");
driver = new InternetExplorerDriver(iecapabilities);
}

driver.manage().window().maximize();
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}

 

How can Selenium Webdriver makes it comfortable with Internet Explorer?

Selenium uses the added executable for driving all the browser invocations and here-forth it takes all the details from the selenium-standalone.jar which should also be placed in your project build path.

In this flow, what happens is Selenium interacts with IE driver, which further makes all mimicry at the browser level.

What is the issue? How to get it resolved?

The issue is no where, but there is some changes which you need to make sure if you want to execute your scripts on IE. For that you need to set your browser security mode to the protected mode, like this:

This should be done for all four areas:

  1. Internet Local

  2. Internet.

  3. Trusted sites.

  4. Restricted sites.

Also, if you want to work with Selenium grid then there are some other issues which you need to tackle.

  1. You can not 2 instances of IE at one time.

  2. You can not apply same command to IE browser at one time. For example, if there is click command executing somewhere then, you have to wait for the executor to finish this step. Then only you can proceed working.

Where is the issue?

The issue is Internet Explorer requires some additional security set-up before the actual browser invocation. So that’s you as a user need to do while working with this browser. And that’s all.

0 views0 comments

Recent Posts

See All
bottom of page