×

Selenium WebDriver - IE [Internet Explorer] browser

Selenium WebDriver - IE [Internet Explorer] browser

In this segment, we will understand how to run a test script with the help of the IE (Internet Explorer) browser.

It is a standalone server that is used to implement the WebDriver’s wire protocol. And it is a link between our tests in Selenium and the Internet Explorer Browser.

We need to have an IEDriverServer.exe executable file to run our test script in the IE browser.

The above executable file starts a server in our local system to run the Selenium WebDriver test scripts.

We will create a test case in the same test suite (new_test), which we created in the previous tutorials.

Step1:

  • Firstly, we will right-click on the src folder and create a new Class File from New → Class in the Eclipse IDE.
Selenium web driver - IE Internet Explorer browser
  • And give your Class name as Test_IE and click on the Finish button.
Selenium web driver - IE Internet Explorer browser 1

Step1:

  • Go to the selenium community and download the IE driver server.
Selenium web driver - IE Internet Explorer browser 2
  • Download the folder to your local system. Unzip the folder and make sure that you downloaded the specified version of IE drivers like 64 bit or 32 bit.
Selenium web driver - IE Internet Explorer browser 3
  • Run the server before launching the IE browser, with the help of System.property.

Syntax:

 System.SetProperty(“key”,”value”);

Where,

Key = “webdriver.ie.driver” 

And then copy the path of the IE driver server to invoke the IEDriver class.

Value= “C:\Users\JTP\Downloads\IEDriverServer_x64_2.48.0\IEDriverServer.exe”

Here, is the sample code to set the system property,

// System Property for IE Driver   
System.setProperty("webdriver.ie.driver","C:\Users\JTP\Downloads\IEDriverServer_x64_2.480\IEDriverServer.exe");
// Instantiate the IEDriver class
WebDriver driver=new InternetExplorerDriver();   

Now, let us see one sample test case, in which we will try to automate the following scenarios in the IE browser.

Steps Action Method Used Input Excepted Result
1. Open the IE Browser. System.setProperty()   The IE browser must be opened.
2. Navigate to the Given URL of the website. get() https://www.google.com/ The home page window must be displayed.
3. Maximize the browser.     The browser window should be maximized.
4. Identify the Google search button and type Gmail after that click on the search button.     The search button should be identified, and the value should be entered.
5. Close the Browser. close()   The browser should beterminated.

Here is the sample code for the above example,

package testpackage;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.ie.InternetExplorerDriver; 
public class Test_IE {
public static void main(String[] args) throws InterruptedException { 
// System Property for IEDriver
System.setProperty("webdriver.ie.driver", "C:\Users\JTP\Downloads\IEDriverServer_x64_2.48.0\IEDriverServer.exe");
// Instantiate an IEDriver class.
WebDriver driver=new InternetExplorerDriver();
// invoke the URL
driver.get("http://www.google.com/"); 
//Maximize the window browser 
driver.manage().window().maximize(); 
// Click on the search text box and pass the value 
driver.findElement(By.name("q")).sendKeys("gmail"); 
Thread.sleep(2000); 
System.out.println("value is passed");
// Click on the search button  
driver.findElement(By.name("btnK")).click(); 
System.out.println("button is clicked");
//close the browser
driver.close(); 
}  
} 
  • Now, right-click on the Eclipse code, and select Run As ? Java Application.
  • When we run this code into the IE server, we may face some challenges, and show the NoSuchSessionException exception.
Selenium web driver - IE Internet Explorer browser 4

To resolve the above exception, we have made some changes.

Before running the web driver code, the below settings should be done in IE Browser:

Browser zoom level should be 100%:-

  • Click on the Setting button, which is present on the right corner of the browser.
  • Then move your cursor to the zoom tab and set the zoom level at 100%.
Selenium web driver - IE Internet Explorer browser 5

Security level for all the zone should be the same:-

  • Go to the tools, then select the Internet Option and go to Security.

Tools ? Internet Options ? Security

Selenium web driver - IE Internet Explorer browser 6
  • For this, we should enable the protect mode checkbox selected for all the zone.
Selenium web driver - IE Internet Explorer browser 7
  • Now re-run the test script and see the output in the IE browser.
Selenium web driver - IE Internet Explorer browser 8

There is one more issue,

 While running a test script in 64-bit window platform:-

  • The speed of the passing value in the search box is typing an alphabet one by one.
  • Not getting any further speed issues in the IE browser, we will run our test script in the 32-bit window platform.
  • To run the test script in the 32-bit version, follow the same process, and download the 32-bit version instead of 64-bit.
Selenium web driver - IE Internet Explorer browser 9
  • Then, download the folder to your local system and unzip the folder.
Selenium web driver - IE Internet Explorer browser 10
  • And do changes in the system property‘s value portion of the IE server in the above code.

Value= “C:\Users\JTP\Downloads\ IEDriverServer_Win32_3.14.0\IEDriverServer.exe”

The new system property will be look like this:

// System Property for IE Driver (32-bit)
System.setProperty("webdriver.ie.driver","C:\Users\JTP\Downloads\IEDriverServer_Win32_3.14.0\IEDriverServer.exe"); 

The output of all print command of the above test script would be displayed in the Eclipse console window.

Selenium web driver - IE Internet Explorer browser 11

 

 


Related Topics

Selenium WebDriver Characteristics

Characteristics of Selenium WebDriver Some of the essential characteristics of Selenium WebDriver are as follows: Multiple Operating System Support Selenium Webdriver supports multiple operating systems like: Desktop OS: Window, Linux, and macOS Mobile OS:...

2 minutes read.

Selenium WebDriver-Alert Popup

Selenium WebDriver-Alert Popup  An alert popup is one of the small message boxes, which used to give some information to the user that displays on the browser. The Alert popup will be...

6 minutes read.

WebDriver-Class Name Locator

WebDriver-Class Name Locator In this tutorial, we will learn about the Class name locator of selenium WebDriver. The Class Name locator is used to identify any element in UI based on the...

4 minutes read.

Verification Controls Methods in Selenium WebDriver

Verification Controls Methods  The verification controls methods are used to check whether the web element is displayed, enabled, and selected. Some of the most commonly used verification controls are as follow: Verification controls Description Return...

4 minutes read.

Selenium WebDriver-CSS Selector: Tag and Class

Selenium WebDriver-CSS Selector: Tag and Class We will locate the web element with the help of tag and class CSS selector in this section of the tutorials Where Tag and class are...

4 minutes read.

Selenium WebDriver- Microsoft Edge Browser

Selenium WebDriver- Microsoft Edge Browser: In this tutorial, we will learn how to launch the Microsoft Edge browser in the Selenium WebDriver. Before we start automating our test script with Microsoft Edge...

4 minutes read.

Selenium Tool Suite

The selenium tool suite is a combination of multiple software tools, and the entire tools having a different approach to support automation testing. Selenium test tool suites are as follows- Selenium...

2 minutes read.

Selenium WebDriver-CSS Selector: Tag and Attribute

Selenium WebDriver-CSS Selector: Tag and Attribute We will locate the web element with the help of Tag and attribute CSS selector in this section of the tutorial. Where Tag and attribute are...

5 minutes read.

Selenium WebDriver-CSS Selector: Tag and ID

Selenium WebDriver-CSS Selector: Tag and ID We will locate the web element with the help of tag and id CSS selector in this section of the tutorials Where Tag and id are...

4 minutes read.

CSS Selector: ID/Class and Attribute in Selenium IDE

CSS SELECTOR: ID/Class and Attribute The Id, class, and attribute of CSS selector are used to identify the web element to access the web pages.  Syntax for Id/Class and Attribute: css= <./#> {[attribute=Value of...

2 minutes read.

CSS Selector: Inner text in Selenium IDE

CSS Selector: Inner text The inner text is used to identify and create a CSS Selector using a string pattern of the HTML tag which is displayed on the web page. Syntax...

1 minute read.

Selenium WebDriver-CSS Selector: Substring Matching

CSS Selector: Substring Matching Selenium WebDriver In this tutorial, we will learn how to identify the web element using the substring method. A Sub-string contains three methods for identifying the web element...

9 minutes read.

Mouse and Keyboard Controls in Selenium WebDriver

Mouse and Keyboard Controls in Selenium WebDriver In this tutorial, we will learn about how to handle mouse and keyboard event using action class in selenium WebDriver. Action Class in Selenium WebDriver: Action...

13 minutes read.

Selenium WebDriver - Firefox or Gecko (Marionette) browser

Selenium web driver-Firefox or Gecko (Marionette) browser In this tutorial, we are going to learn how to run the Selenium WebDriver test script in the Firefox Browser using the Gecko Driver. Before going...

4 minutes read.

Selenium WebDriver-XPath Locator

Selenium WebDriver-XPath Locator The locators can make the object identification of all the selenium tools. There are eight locators available in selenium web driver, but most of the time we go for...

14 minutes read.

Id Locator in Selenium IDE

Id Locator Id locator is used to find the web element by the help of id of that element because ID is likely to be unique for each web element. Target Format: Id=id of the...

2 minutes read.

Selenium WebDriver- Radio button handling

Selenium WebDriver- Radio button handling In this tutorial, we will be learning about handling the radio button in selenium WebDriver. Let us take one example to give you a better understanding of...

3 minutes read.

XPath Axes Selenium WebDriver

XPath Axes XPath axes are those axes that are used to search for the multiple nodes in the XML document from the current node context. These methods are mainly used when the...

14 minutes read.

WebDriver-Partial Link Text locator

WebDriver-Partial Link Text locator In selenium WebDriver, there is an additional way to find a web link element with the help of partial link text locator. The partial link text is used...

4 minutes read.

Selenium vs QTP

In this section, we are comparing the most frequently used automation tool –Selenium and QTP. Selenium and QTP have relative advantages over each other- FeaturesSeleniumHP QTPLicensingSelenium is an open-source testing tool....

3 minutes read.