Internet Explorer browser is still chosen by a section of people for internet browsing. These users are mainly the ones who have been using the IE browser for a long time and want to continue using it as they are habituated to it. Also, it must be remembered that IE is one of the earliest brands established in the market. Since Selenium gives the option of running our tests in multiple browsers, Selenium with IE browser blending can be used to test any application. IE has a driver, which creates a connection between Selenium WebDriver and IE. and then executes the Selenium tests on Internet Explorer. Let us explore How to run Selenium Tests on Internet Explorer by discussing the below topics:
- Internet Explorer Driver Selenium Options
- Internet Explorer Driver Selenium
- Internet Explorer Driver Download For Selenium
- Cached
- What is Selenium IE Driver?
- What are the pre-conditions for Selenium IE Driver?
- How to install IE Driver on Windows?
- How to download IE Driver on Windows?
- Also, how to configure IE Driver on Windows?
- How to run Selenium tests on Internet Explorer browser?
- How to download IE Driver on Mac OS?
- Jun 24, 2021 WebDriver testing frameworks exist for all major platforms and languages. One such framework is Selenium. Internet Explorer Driver: An implementation of the WebDriver protocol specifically for Internet Explorer. To run legacy end-to-end tests for Internet Explorer, we recommend using Internet Explorer Driver.
- WebDriver can also more accurately simulate user events or OS-level events. To download the WebDriver capabilities, go to the following Microsoft website: IE Web Driver Tool for Internet Explorer 11 The downloaded version of WebDriver is incompatible with the WebDriver version that is introduced in the Internet Explorer Developer Channel version.
Apr 07, 2021 Selenium Internet Explorer Driver is used to execute test cases in the Internet Explorer browser. It is a standalone server that establishes a link between our Selenium test and the Internet Explorer browser. Selenium WebDriver- Running test on IE Browser. In this section, you will learn how to run your Selenium Test Scripts on IE Browser. Internet Explorer implements the WebDriver protocol using Internet Explorer Driver Server. The Internet explorer Driver Server is the link between your tests in Selenium and the Internet Explorer Browser.
What is Selenium Internet Explorer Driver or IE Driver?
IE Driver is the connection that enables the users to execute Selenium test cases on the IE browser. It is an independent server that administers the open-source Selenium WebDriver Protocol. The Selenium tests communicate with the IE Driver via the JsonWireProtocol, which converts the commands in Selenium into actions on the IE browser.
The main objective of the IE Driver is to communicate with Internet Explorer. It is not feasible to execute Selenium test cases on IE without it. An IE Driver can be used by instantiating an object of the IE Driver and assigning it to the WebDriver object. Then utilizing it for browser actions.
What are the pre-conditions for Selenium Internet Explorer Driver or IE Driver?
Before we can begin creating tests in Selenium or configuring the IE Driver so as we can run Selenium tests on Internet Explorer, we should take care of a few pre-conditions on our system:
- Java JDK - We need the JDK or Java Development Kit for the Java programs. It has the JRE and multiple development tools like the debugger and compiler.
- Java IDE - Integrated Development Environment(IDE) assists in writing the Java programs. It has multiple features for end-user programming. Here, we will be using the Eclipse IDE. Any other alternative Java IDE can also be used.
- Selenium WebDriver - To build the Selenium tests, we require Selenium WebDriver. You can download it from the official Selenium site. For more details, you can refer to the topic: Configure Selenium WebDriver.
For this tutorial, we can use either the Selenium 3 or Selenium 4 version.
How to install IE Driver on Windows?
Let's proceed further and discuss how to set up the IE Driver with your Selenium Java project and run test cases on IE. Initially, we will download the IE Driver. Let's investigate how we can carry it out on Windows operating system?
How to download IE Driver on Windows?
Prior to download the IE Driver, we will note the version of the IE browser on our system. IE Driver version that we need to download has to be compatible with the IE browser version. Follow the steps listed below, to check the browser version:
- Firstly, to know the IE browser version on your machine, click on Help in the menu.
- Secondly, click on About Internet Explorer in the sub-menu.
- After clicking the About Internet Explorer option, the following pop-up will open. Therefore, we will get the IE version information as shown in the image below:
Now, as we have the version of the IE browser, we can proceed further. Configure the IE Driver with the steps mentioned below:
- First, go to the link. In the below image, we have seen both the 32 bit Windows IE and 64 bit Windows IE available for Windows. You can download the zip file of the IE Driver which is compatible with your operating system and the browser.
- Then, as the download is successful, unzip the zip file and keep it in a particular location.
Create a Java project after opening Eclipse. Incorporate all the project dependencies. To know how to create a Java project with Selenium WebDriver in Eclipse, go through the complete tutorial at Configure Selenium WebDriver.
As the following step, we require to make this IE Driver accessible to the Selenium tests.
Let's discuss how to configure IE Driver so that it can be utilized in the Selenium scripts.
How to configure IE Driver on Windows?
To configure IE Driver with Selenium, so as we can run Selenium tests on Internet Explorer, the IE Driver executable file should be made available to the test scripts. Selenium test cases can approach the IE Driver by following any one of the ways:
Setting up the IE Driver via System Properties in Environment Variables.
Setting up the IE Driver via System Properties in the script.
Let's understand all these and make an attempt to execute our code with Selenium 3 or Selenium 4.
How to configure IE Driver via System Properties in Environment Variables?
We can define system-level variables via Environment Variables. Moreover, users have the option to declare either system variables or user-level variables. Besides, the variables declared here can be utilized by every program executing on the system.
Additionally, we can take the help of environment variables to set the IE Driver path. As we have an instance of the WebDriver, it will by default identify the IE Driver path from the system variables. Subsequently, let’s explore the steps by which we can achieve that.
- Firstly, we open the Environment Variables pop-up. For that, click on the search box and type env. Consequently, it will show Edit the system environment variables as displayed in the below image. Click on it.
- Secondly, the System Properties pop-up will come up. Go to the Advanced tab inside the pop-up. Next, in the Advanced tab, click on Environment Variables.
Internet Explorer Driver Selenium Options
- Thirdly, it will open the Environment Variables pop-up. Within the System variables section, search for the Path variable as highlighted in the image below. Then, select it. Finally, after selection, click on Edit as highlighted in the image.
- Fourthly, as the Edit environment variable pop-up opens up, click on New.
- Finally, add the location of the IE Driver folder path. We have kept our driver in the location C:Seleniumiedriver, hence we have added that in the path variable. Then click on OK.
How to run Selenium tests on Internet Explorer browser?
So, now let's see how we can run Selenium tests on Internet Explorer. Consequently, we can initialize the WebDriver instance with the help of IE Driver, as described below:
On running the above code, the output shall be:
From the console output, it is obvious that there is no WebDriver issue, indicating it's set up is accurate. Also, we can find the print statement at the start and end of execution.
Internet Explorer Driver Selenium
How to initialize IE Driver via System Properties in the script?
We can initialize IE Driver by directly specifying the path in the script. In simpler terms, we have to add the following line of code to set up the system properties for the IE Driver, as given below:
Let us update the code we have used above and confirm that we can launch the IE browser accurately. The updated code should be similar to this:
You will find that google.com opens in the IE browser without any issue and exception.
So, in this way, you can execute your Selenium tests on a particular version of IE by mentioning the direct path of the IE Driver within the setProperty() method. Additionally, the logs point to the fact that our WebDriver session began with the print statement and confirms that tests are executed in IE version 11 in Windows.
How to download IE Driver on Mac OS?
The macOS does not back IE. But if we have to execute our Selenium tests in IE, there are multiple ways that can be done:
Internet Explorer Driver Download For Selenium
- Oracle VM Virtual Box - To verify IE on macOS, we can install VM Virtual Box on our system.
- Cross Browser Testing on Cloud - This is one of the popular ways to do cross-browser testing. LambdaTest is one of the testing platforms to perform a cross-browser check.
Key Takeaways
Cached
- IE has deprecated, but we still use it for cross-browser testing.
- Additionally, make sure to set the browser zoom level 100% for IE before execution.