×

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 NewClass 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- Checkbox handling

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

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

Selenium Testing

Selenium is a functional testing tool and compatible with non–functional testing tool. Selenium is free and not required any licensing. There are specified types of testing that can be automated using Selenium:-   Functional Testing: Checking every component...

3 minutes read.

Xpath locator in Selenium IDE

X PATH LOCATOR: Xpath is used to identify the element using any attribute or visible test. Syntax for X PATH:- //html tag [@attribute=’value’] e.g. - //div [@class=’label’]                    OR //html tag [text () =’Visible Text’] e.g.-//div [text...

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

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-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 - Browser Controls Commands

Selenium WebDriver - Browser Controls Commands WebDriver includes operations like opening a browser, fetch the title, and closing the browser, etc. Some of the most commonly used Browser controls commands for Selenium WebDriver...

6 minutes read.

CSS Selector: Class in selenium IDE

CSS Selector: Class Identify a web element with the help of Class as a CSS Selector is like using id attribute. The only difference between Class and id is in their...

2 minutes read.

First test case of Selenium-IDE

First Test Case of Selenium-IDE: In this part, we are discussing how to create a basic test case in Selenium-IDE: The entire test script execution process in Selenium -IDE can be divided...

4 minutes read.

Selenium WebDriver-CSS Selector: Tag Class and Attribute

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

5 minutes read.

WebDriver Interface | Class Diagram

WebDriver interface/class diagram: The interface of WebDriver includes the following stages, which is as follows: Search Context Web driver Remote web driver Driver class Search Context  The first interface of the web driver class is search Context,...

2 minutes read.

WebDriver-Id Locator

WebDriver-Id Locator: The Id Locator is used to identify any web element in UI with the help of the ID attribute. The First preference is always goes to ID locator while inspecting...

4 minutes read.

Difference between Selenium WebDriver and Selenium RC

Difference between Selenium WebDriver, and Selenium RC: Selenium WebDriver and selenium RC (Remote Control) both are different in any manners which we see later in this tutorial, let us see the...

3 minutes read.

Selenium IDE Tutorial for Beginners

Selenium IDE Introduction Selenium IDE stands for Integrated Development Environment. Selenium-IDE is released in 2006 and developed by SHINYA [JAPAN] THOUGHTWORK Company. Selenium IDE implemented as a Firefox plug-in, and concedes the record, edit, and debug tests....

2 minutes read.

Selenium WebDriver - Google Chrome Browser

Selenium WebDriver - Google Chrome Browser In this tutorial, we will learn how to run our Selenium Test Scripts in the Google Chrome Browser. To implement the WebDriver protocol with the help...

3 minutes read.

Operational Controls Methods in Selenium WebDriver

Operational Controls Methods The Operational controls are used to perform all the actions on the web elements like click on the button, pass the value in the text box, and click...

4 minutes read.

Selenium WebDriver – Web Element Controls

Selenium WebDriver – Web Element Controls A web element is an interface that is implemented by a remote web element class. The Web element control can be used to perform the data...

1 minute read.

Name Locator in Selenium IDE

NAME LOCATOR: It is used to find the name in the web element. If we have multiple web elements of the same name, then the first matched element would be returned. Open the...

3 minutes 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.