Execute Selenium Test on IE Browser

To execute Selenium WebDriver Script on IE Browser, you have to download IEDriver Server.

Why IEDriver server is Required?

IEDriver Server is a standalone server used by Selenium WebDriver to communicate with IE Browser or we can say that Selenium can actually controls the IE browser using IEDriver Server.

Selenium WebDriver interacts with IEDriver server through JSON wire Protocol and then IEDriver Server further communicate with IE browser. So basically, it acts as a bridge between selenium and IE Browser. Just have a look at below picture :

IEDriverServer

InternetExplorerDriver server can be downloaded from http://selenium-release.storage.googleapis.com/index.html

IEDriverServerDownload

NOTES:

  • IEDriver server is available with 32 and 64 bit versions. Our recommendation is to use 32 bit version as it is less prone to errors comparatively from 64 bit version.
  •  IEDriver Server has already been tested on IE 7, 8, 9 ,10 & 11 along with combination of Windows 7, 8 and Vista OS.
  • IE 6 Browser is no longer supported.

Command to setup IEDriver Server path in your selenium code


System.setProperty("webdriver.ie.driver", "D:/selenium/IEDriverServer.exe");

Sample Script


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class Test1 {

	public static void main(String[] s) throws InterruptedException {
		// Set IE driver path
		System.setProperty("webdriver.ie.driver", "D:/selenium/IEDriverServer.exe");

		// Initialize IE Driver
		WebDriver driver = new InternetExplorerDriver();

		// Launch Facebook on IE Browser
		driver.get("http://www.facebook.com/");

		// Wait for 5 seconds
		Thread.sleep(5000);

		// Close Browser
		driver.close();

	}
}

Important Notes

1. Try to use CSS Selector over XPATH to avoid issues while executing scripts on IE Browser.

2. IEDriver Server is comparatively slow as compare to other Servers like ChromeDriver. Mean to say, Selenium Script execution is fast on other browsers like Firefox and Chrome as compare to IE Browser.

3. If you are getting following error while executing script on IE Browser :

"Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones."

Refer following solution to overcome from the above mentioned issue : Click Here

Kindly refer to IEDriver documentation in case you stuck with any configuration issue.

If you really like the information provided above, please don’t forget to like us on Facebook, you can also leave the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *