Today sharing a list of Challenges to run Selenium WebDriver scripts in IE browser that most of automation engineers face while running his/her webdriver scripts in the IE browser.
Problem 1: The path to the driver executable must be set by the webdriver.ie.driver system property;
1- Navigate to following link http://docs.seleniumhq.org/download/
2– Go to “The Internet Explorer Driver Server” label and download 32 or 64 bit Windows IE according to your system architecture.
Note: In this example, Older version of Selenium WebDriver Standalone jar has been used. So if you are using in current days then go and download the recent version of jar and equivalent set of executable jar.
3- Go to downloaded folder and extract the downloaded zip file and extract it.
4- Copy the path of IEDriverServer.exe file(Suppose file path is something like this C:\Driver EXE\IEDriverServer.exe) and go to eclipse and search for following line of code
driver = new InternetExplorerDriver();
replace it with following line of code
System.setProperty("webdriver.ie.driver", "<path in your compute>\\IEDriverServer.exe");
driver = new InternetExplorerDriver();
5- Close all instance of IE browser on your machine and run the script,this time it should work.
Problem 2: Unexpected error launching Internet Explorer. Browser zoom level was set to <100% >. It should be set to 100% or In case of IE11, 3 instance of IE browser opens when we are trying to run our script in IE browser and test fails, while same script is running fine in Chrome and Firefox. Error stack looks like this.
Started InternetExplorerDriver server (32-bit) 184.108.40.206 Listening on port 22821 Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 75%. It should be set to 100% (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 12.18 seconds
Solution : To resolve this problem we need to set the Zoom percentage of IE browser to default 100%
1- Open you IE browser (any version from 8-11)
2- Navigate to View ==> Zoom ==> Set 100 % or you may use CTRL+0 (Zero) <See snapshot>
3- Close your IE browser and again run your script
You script will start its execution and you would be able to complete your test execution in IE Browser.
Problem 3:SendKeys types character very very slow when running script in IE browser.
Solution : This can be resolved just by replacing your current IEDriverServer.exe(if you are working on 64 bit machine) with IEDriverServer.exe of 32 bit
1- Download IEDriverServer executable of 32 bit, no matter either your are using 64 bit machine or 32 bit machine. Download it from seleniumhq.org under download tab and it will look like this(Assuming when you are using this post, version of this executable might have changed.
since we have copies IEDriverServer.exe in project but if you have extracted it some where in your computer then give the path of IEDriverServer.exe like this
System.setProperty("webdriver.ie.driver", "C:\\Driver EXE\\IEDriverServer.exe");
C:\Driver EXE\IEDriverServer.exe is the path where i have kept this exe in my machine.
3- Run your script again and this time you would see sendsKey() as it should work and the way it is working in Chrome and Firefox.
Problem 4: Unexpected error launching Internet Explorer. Protected Mode must be set to the same value and error stack would look like this.
org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_25'
Driver info: driver.version: InternetExplorerDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
For above problem read the following post Unexpected error launching Internet Explorer. Protected Mode must be set to the same value
Problem 5: Untrusted SSL certificate error in IE browser
There are two ways
1- Open the URL for which SSL certificate is coming so put this line of code to resolve SSL Certificate Error just after line, so the structure of code would be something like this
driver.get(“URL for which certificate error is coming”);
After this line of code put your complete script.
The second method is totally based on DesiredCapability (Copy following code
System.setProperty("webdriver.ie.driver", "path of IEDriverServer.exe in your computer");
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
// this line of code is to resolve protected mode issue capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver = new InternetExplorerDriver(capabilities);
After putting the above code, run your script, this time no SSL Certificate Error would appear on screen and the script would run fine.