Working with Internet Explorer

July 25, 2016

As we already discussed how Selenium works with Firefox and Chrome browser, we will be focusing on the interaction of Selenium WebDriver with Internet Explorer browser. Just to recollect WebDriver has an inbuilt support for Firefox, no additional driver is  required. Chrome browser requires Chrome Driver and we need to set a system property for the same. To learn more about Chrome Driver visit Working with Chrome.

WebDriver interacts in a similar way with IE browser as it interacts with Chrome. So talking about similarity IE also requires Internet Explorer driver like we had Chrome driver for Chrome browser.

Setting up Environment for IE:

  • Go to Selenium’s official site i.e. http://www.seleniumhq.org/download
  • Under “The Internet Explorer Driver Server” section we can download IE driver as per our system requirement.It comes as 32 bit Windows IE and 64 bit Windows IE. Refer this for better clarity:
  • Click on 32 bit Windows IE or 64 bit Windows IE as per your Operating System.
  • Extract the zip file.
  • Set the value of a System variable with the path of its driver location.

setProperty() method accepts two String arguments. the first one is a variable name (here, IE driver name i.e. webdriver.ie.driver) and second is its value (here, the location of IE driver on your local machine e.g. C:\Users\dell\Downloads\IEDriverServer.exe).

Challenges faced with IE Driver:

Till now the steps we followed were correct but still on invoking browser we will be getting error on console screen saying :

org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stack trace information)Command duration or timeout: 516 milliseconds

Addition configurations required for IE:

Just downloading IE driver and setting system property in case of IE browser doesn’t help. Additionally, we have to make some setting in our browser.Follow these steps-

  1. Go to IE Browser
  2. Tools menu ->Internet Options in tools menu->Security tab
  3. Select Enable Protected Mode option -> Check the default Zone level for “Internet”. If you look at the screenshot below, security level for this zone is selected as “Allowed level for this zone ” “Medium to High” and “Enable Protected Mode” option is Checked

Challenges faced with IE Driver

  1. Likewise, for Local Intranet and Trusted sites we will keep same settings i.e. Enable protected mode Checked and Security level for zones set to Medium-high as per above example.Security level for zone could be set as High,Medium etc. but then it needs to be same for the Internet,Local Intranet, and Trusted sites.
  2. Restricted sites “Enable Protection mode” is checked by default and we can need to leave it as it is. No settings required for it.

All other code lines and basic API’s remain same like that of Internet Explorer like Firefox and Chrome browser.

To go through all the API’s visit Working with Firefox.

For any questions, query or feedback. Feel free to write us at amrita@qatechhub.com or support@qatechhub.com. 

Happy Learning 🙂

Amrita Joshi

About the Author

Amrita Joshi

Leave a Comment: