How to execute WebDriver Script in IE Browser ?

In order to execute Selenium script in IE Browser, first you have to download IEDriver Server.

IEDriver Server is a standalone server which implements WebDriver’s wire protocol and it can be downloaded from http://selenium-release.storage.googleapis.com/index.html

1

NOTES :
a) IEDriver server is available in 32 and 64 bit versions. I would recommend to use 32 bit version as it is less prone to errors comparatively from 64 bit version.

b) IEDriver Server has already been tested on IE 7, 8, 9 ,10 & 11 along with combination of Windows 7, 8 and Vista OS.

c) IE 6 Browser is no longer supported

IEDriver Server is a standalone server which selenium uses to communicate with IE browser.

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

2

Command to setup IEDriver Server path in your selenium code


System.setProperty("webdriver.ie.driver", "iedriverdriverpath/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:/workspace/SampleProject/driver-servers/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. To avoid issues when executing scripts on IE Browser, try to use CSS Selector over XPATH

2. IEDriver Server is comparatively slow as compare to other Drivers. Mean to say, 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

I would recommend you to refer IEDriver required configuration in case you are facing any 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 *