Challenges to run Selenium WebDriver scripts in IE Browser
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;
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.
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) 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.
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 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.
2-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)
Solution:
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
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 the 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:
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); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, 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.
Nice collection of IE problems.
Thanks for articulating and sharing information.
Good One Dwarika…This would certainly help people working on IE.
Keep up the good work.
Thank you for your kind words Shruti!!
Nice work and thanks for sharing.
-Vinay
Hi Dwarika can you also tell us about the flicking issue of IE browser while taking screenshot. Do you have any solution for the same.
@Nilesh
Actually i have also tried a-lot but finally settled with Robot Class ScreenShot method for IE.
So i would suggest to take the code of taking screenshot using robot and it will work for all the three browsers.
Dwarika,
Its not good way taking screenshot using robot class.
While you are using selenium grid concept it will always take Hub machine screen shot.
So better try to use selenium screen shot method.
Thanks!! Will share my thought on this and if you want to cntribute on this just by writing any post
Then you may contact me on dwarika1987@gmail.com
can some help me on how to connect to WINSCP server and do the file transfers from local to server in Selenium,do we need to use any tool?
Thanks its working fine for me
Hi Dwarika.
I found very much helpful article above.
But my problem is quite different.
We have website on which we have sheets same as excel sheet.
I have created few scripts for that and all are working fine on FF browser.
and when i run same script on IE my script is successfully invoking IE and logged in user and also able to navigate on sheet, but problem starts now it gives element not fond error.
I have tried by using xpath as well as CSS.
So, please help me how to handle this situation.
Sorry add some point above, the problem is when user try to click on any cell it gives element not fond error.
Do one thing when you are landing on page put some wait and then keep trigger escape button using action class and again put some wait anf
Then check this will work for you because there might be probability that some element would not
Be downloaded properly
Very nice analysis.. Helpful to everyone..
Thank q dwarika
Hi,
i am trying to run selenium scripts on IE11/IE10, it is launching the browser but automatically my system getting restart(while running on other browser its working fine)
can some one please provide me a solution if.
thanks
I am facing issue while opening the URL in IE.
Url gets open but one small window also gets open with the same url it is a kind of “System Information” I don’t understand how to focus that window or close it.
It is not opening in the same window but in the other window, so I think it is not a POP UP.
Selenium web driver is not able to focus on the URL which I am trying to open although focus is on the other small window.
Try to figure out the number of windows those are opened just after pop up appear on screen.. and try to switch in to one after another window..
In some scenario, In IE we have observed twice and thrice that focus shift to pop up without any effort and we need to make effort to shift the control on main window.
So try these two things…This might help you!!
Hi ,
In IE i am not able to driver.switchTo().window(winHandle); it works for FF and chrome .
Thanks its very helpulf
If I try to launch a I explorer with
driver.get (“www.facebook”);
It is not opening the Facebook instead it is displaying like this the start page for Web drivrr
Update your iedriver exe and it will start working
Thanks for these solutions, I faced the three problems and thanks to you I got solved, well done!
IE11 RUNS ARE hanging on windows 10 when we run bulk scripts.
and it is not thowring any error/exception.
Probably you need to download new Version of IEDriverServer.exe and also need to download IE 11 (Or go and update your IE11 browser) it will resolve the issue. Since this is just the compatibility issue of IE 11 with Edge what i think… and one more thing try to reduce the number of xpath in IE11..use some other locators.
So try this might be it will resolve your issue.
Thanks!!
Hi,
I am using Selenium 2.44 and IEDriverserver 32 bit. When I am running test cases on IE10, they are breaking at Click() event. sendKeys(Keys.ENTER) didn’t solve my problem either. I am trying to click on searchable dropdown when facing the issue.
Hi
Thank you for this descriptive write up.
When I run my scripts with Selenium 2.51 and IEDriverServer.exe 2.53 64 bit, the browser opens for a second and then gets closed immediately. I see in the eclipse console the following output:
Started InternetExplorerDriver server (64-bit)
2.53.0.0
Listening on port 35970
Only local connections are allowed
And the driverexe in active in the task manager.
Can you please help troubleshoot this issue. I did all the config and code changes mentioned in this post.
Hi,
I am unable take the proper screenshot in the IE11 using selenium grid. I am using 5 instance of IE for execution. The screenshots for the results are tagged to the active screen in the application. It is not giving the exact browsers screenshot. Please advice on the same
hi keys.enter is not working in selenium webdriver in internet explorer
Hi,
I have a scenario where one dropbox contains few check box have drill down features. if checkbox1 checked then set of checkboxes will appear in below division. Code is like below:
MUMBAI
LUCKNOW
CALCUTTA
DELHI
CHENNAI
Div id=branch have 5 branch. if branch Mumbai selected then dependent checkbox will appear.
This functionality work properly if i do manually. but it wont perform like this, if i script in selenium.
Means if i select branch mumbai it will div id=”1C” will not appear.
Note:- it is only happening in IE11. Other broweser it work properly
Please help me on this.
before clicking on checkbox use isenabled method and use wait after clicking
I have a problem where IE11 will throw an alert that Internet Explorer has stopped working. Our test box is a VM machine. When this occurs the test hangs until the job times out and leaves and instance of the driver running. How do I fix this? I’ve already implemented the fixes listed here.
DesiredCapabilities capability;
capability = DesiredCapabilities.internetExplorer();
capability.setCapability("ignoreProtectedModeSettings", true);
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability("ignoreZoomSetting", true);
capability.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
log.info("internet explorer native events set to false");
// capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capability.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
// capability.setCapability("ie.forceCreateProcessApi", true);//
// capability.setCapability("requireWindowFocus", true);
return new InternetExplorerDriver(capability);
I would say to check your iedriver.exe version and download the latest one from selenium headquarter site.
Hi,
I am using selenium 3.0.1 , IE 11 and when i try to run the parllel threads at a time focus is getting shifted to another window while entering values in one window and getting failed as credentials were not correct.
Is there any way to get it set, focus stays on same window while entering values(sendKeys() method in progress).
Gracias amigo sus sabios consejos resolvieron mi problema de mas de una semana.
mil gracias.
I login system and do some functional test
When the new window is opened,I switch to the new window succefully
but has been logout ?
In other browsers,there is no situation like this.
Log a defect for session management and ask your team to fix it
Try using switch browser
Hi,
When i am executing more than 50 test cases oncethe execution is stuck in ride. And unable to execute the further test cases
Can you please suggest how to execute mroe than 50 test cases in bulk in IE
Thanks,
Shruti
I am facing issue while opening the URL in IE.
Url gets open but two Sub window also gets open with the same url. I don’t understand how to focus that window or close it.
When i tried to identifies number windows using window handles Method only two windows identified.
but unfortunately application components opened in unrecognized windows.
due to these scripts are getting failed.
your suggestion is precious for me
IE Navigate issues.
Url gets open but two Sub window also gets open with the same url. I don’t understand how to focus that window or close it.
When i tried to identifies number windows using window handles Method only two windows identified.
but unfortunately application components opened in unrecognized windows.
due to these scripts are getting failed.
your suggestion is precious for me
Hi Anand,
Please make the zoom percentage to 100% for your ie browser, This issue will get resolved.
and then try to execute the script.
Thanks
Dwarika
when i use IE to run test scripts with iedriver-32bit,the ie browser can not manage session normally
namely, when i click a link in one window,ie will open it in a new window,but in the new window,ie need me to login again,in fact I have logined successfully in the old window, but do not know why ie can not use cookie and session ,ps the same scripts can run succfully on firefox and chrome;
would you give me some advice?