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.
The path to the driver executable must be set by the webdriver.ie.driver system propertyNote:  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>

Unexpected error launching Internet Explorer

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.

Internet Explorer third party binding
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.

Dwarika Dhish Mishra

My name is Dwarika Dhish Mishra, its just my name and I am trying to bring the worth of my name in to actions and wants to be the solution not the problem. I believe in spreading knowledge and happiness. More over I am fun loving person and like travelling a lot. By nature I am a tester and a solution maker. I believe in the tag line of http://ted.org “Idea worth spreading” . For the same, I have created this blog to bring more and more learning to tester fraternity through day to day learning in professional and personal life. All contents are the part of my learning and so are available for all..So please spread the contents as much as you can at your end so that it could reach to every needful people in testing fraternity. I am pretty happy that more and more people are showing interest to become the part your Abode QA blog and I think this is good sign for us all because more and more content would be before you to read and to cherish. You may write or call me at my Email id: dwarika1987@gmail.com Cell: 9999978609

You may also like...

44 Responses

  1. Jitenrda says:

    Nice collection of IE problems.
    Thanks for articulating and sharing information.

  2. Shruti Shrivastava says:

    Good One Dwarika…This would certainly help people working on IE.

    Keep up the good work.

  3. Vinay Shah says:

    Nice work and thanks for sharing.

    -Vinay

  4. Nilesh says:

    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.

  5. Krish Reddy says:

    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?

  6. subbiah says:

    Thanks its working fine for me

  7. Nasim Akhter says:

    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.

    • Nasim Akhter says:

      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

  8. Vamshi says:

    Very nice analysis.. Helpful to everyone..

    Thank q dwarika

  9. navnit says:

    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

  10. Nitin Gupta says:

    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!!

  11. Sunray says:

    Thanks its very helpulf

  12. ajay singh says:

    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

  13. Victor Lopez says:

    Thanks for these solutions, I faced the three problems and thanks to you I got solved, well done!

  14. madhu says:

    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!!

  15. Andy says:

    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.

  16. Tester123 says:

    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.

  17. Ashwin says:

    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

  18. satmisha says:

    hi keys.enter is not working in selenium webdriver in internet explorer

  19. Jayant Kumar Sinha says:

    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.

  20. Nishikant Ravekar says:

    before clicking on checkbox use isenabled method and use wait after clicking

  21. karina says:

    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);

  22. Dinesh says:

    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).

  23. Jeferson says:

    Gracias amigo sus sabios consejos resolvieron mi problema de mas de una semana.

    mil gracias.

  24. luke says:

    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.

  25. shruthi says:

    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

  26. Anand says:

    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

  27. Anand says:

    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

  28. luke says:

    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?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.