Running tests in IE is quite easy. Internet Explorer can’t be launched directly, we have to communicate with the Internet Explorer through Internet Explorer driver.

Internet Explorer Driver Server

Internet Explorer Driver Server is the link between your selenium tests and the Internet Explorer browser. As selenium WebDriver has no native implementation of IE, we have to address all the driver commands through IE driver server.

Download and Install Internet Explorer Driver

IE driver server is an executable file that needs to have in one of the system paths before running your tests. The following are the steps to download Internet Explorer Driver.

  • Step 1: Go to the Selenium official website and select appropriate version for Internet Explorer driver based on your operating system

Note: Here we are working on Windows Operating system, we need to download the corresponding IE driver of Windows version. If your Operating System is Linux or Mac then you need to download the latest release of Internet Explorer driver which is compatible with your test environment.

IE-Driver-Server

 

IE Driver Server

  • Step 2: Once the ZIP file download is complete, extract the ZIP file and keep it somewhere on a known location on your system.

Points to remember when working with IE

  • Zoom level should set to 100%
  • Protected mode should be turned off and make a level to least positions ie to bottom down position.

When we run Selenium WebDriver Script in Internet Explorer browser, we may fail to launch IE driver using Selenium WebDriver. Below are the two errors users may face when we run Selenium WebDriver Scripts in IE browser when we won’t set above two points.

Failed to Launch IE Driver using Selenium WebDriver

Sometimes many of the Selenium WebDriver users failed to launch IE driver using Selenium WebDriver. To get rid of the common issues here are the solutions most of the users might have faced.

Error 1:

Exception in thread “main” org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. In IE browser Protected Mode settings are not the same for all zones. Protected Mode must be set to the same value for all zones.

Solution: To fix the error, we need to enable protected mode for all zones and mode should be turned off and make a level to least positions i.e to bottom down position.

Below are the steps to enable protected mode for all zones.

  • Step 1: Open Internet Explorer
  • Step 2: Go toTools menu – Internet Options

 

Internet Options

Error 2:

Exception in thread “main” org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 200%. It should be set to 100%

Solution: To fix the error, we need to set the Zoom level to 100% of Internet Explorer browser.

Below are the steps to set the Zoom level to 100%.

  • Step 1: Open Internet Explorer
  • Step 2: Go toTools menu – View – Zoom – Select 100%
  • Zoom

 

Zoom

Launching IE browser using Selenium WebDriver

Setting up the webdriver.ie.driver property

Selenium WebDriver has a class called InternetExplorerDriver that is used to launch and control IE browser. The code to launch IE Driver is exactly the same as if you were launching a FirefoxDriver or ChromeDriver. All we need to Set a system property “webdriver.ie.driver” to the path of executable file “IEDriverServer.exe“. If you miss this, you will face an error “The path to the driver executable must be set by the webdriver.ie.driver system property“.


package com.journaldev.selenium.InternetExplorer;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class LaunchingIE {
    public static void main(String[] args) {
    System.setproperty("Webdriver.ie.driver","D:\Drivers\IEDriverServer.exe");
    WebDriver driver = new InternetExplorerDriver();
    driver.get("https://journaldev.com");
    String PageTitle = driver.getTitle();
    System.out.println("Page Title is:" + PageTitle);
    driver.close();
    }
 }

When you run the above program you will notice that Journaldev.com is opened in the new Internet Explorer window and it will print the website title in the console.

By admin

Leave a Reply

%d bloggers like this: