Today sharing list of Challenges to run Selenium WebDriver scripts in IE browser that most of automation engineer face while running his/her webdriver scipts in IE browser.
Problem 1: The path to the driver executable must be set by the webdriver.ie.driver system property;
Solution: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.
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
replace it with following line of code
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.
Solution: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.
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", "C:\\Driver EXE\\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)
2.42.0.0
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%
Steps:
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.
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
Steps:
1- Download IEDriverServer executable of 32 bit, no matter either your are using 64 bit machine or 32 bit machinehere is the link : http://selenium-release.storage.googleapis.com/2.41/IEDriverServer_Win32_2.41.0.zip2-Once file get downloaded then extract the Zip file and copy the IEDriverServer.exe file and paste it in your project and set the system property for IE
1- Download IEDriverServer executable of 32 bit, no matter either your are using 64 bit machine or 32 bit machinehere is the link : http://selenium-release.storage.googleapis.com/2.41/IEDriverServer_Win32_2.41.0.zip2-Once file get downloaded then extract the Zip file and copy the IEDriverServer.exe file and paste it in your project and set the system property for IE
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
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)
Problem 5: Untrusted SSL certificate error in IE browser
Solution:There are two ways
First:
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 structure of code would be something like this
driver.get(“URL for which certificate error is coming”);
driver.navigate().to(“javascript:document.getElementById(‘overridelink’).click()”);
After this line of code put your complete script.
Solution:There are two ways
First:
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 structure of code would be something like this
driver.get(“URL for which certificate error is coming”);
driver.navigate().to(“javascript:document.getElementById(‘overridelink’).click()”);
After this line of code put your complete script.
Second:Second method is totally based on DesiredCapability (Copy following code
After putting above code, run your script, this time no SSL Certificate Error would appear on screen and script would run fine.
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);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new InternetExplorerDriver(capabilities);
After putting above code, run your script, this time no SSL Certificate Error would appear on screen and script would run fine.