How To Run Selenium WebDriver Test Script In Internet Explorer With Steps

Frequently nosotros ask to run selenium WebDriver test inward dissimilar browsers similar run selenium inward network explorer, Google Chrome, Opera, Mozilla Firefox etc.. for browser compatibility software testing. Selenium WebDriver software testing tool has carve upward driver for each browser. Selenium WebDriver has InternetExplorerDriver for IE browser. Earlier, I have already described HOW TO RUN WEBDRIVER TEST SCRIPT IN FIREFOX in addition to HOW TO RUN TEST SCRIPT IN GOOGLE CHROME BROWSER. Now let's larn how to operate WebDriver examine In IE for software spider web application.

Configuration Steps To Run selenium Test In  network explorer

Step 1 : Download IEDriverServer.exe
For running selenium network explorer test, yous need IEDriverServer.exe. You tin plough over the sack download It from It from bellow given links.
  • Go to THIS PAGE in addition to click on IEDriverServer.zip link.
Alternate download location
  • You tin plough over the sack download It from THIS PAGE besides every bit shown In bellow Image.

Save IEDriverServer.exe In your D: drive.

Step 2 : Configure IE Browser To Resolve Expected Errors
Before running your software automation selenium network explorer test, You ask to configure your IE browser to resolved bellow given 2 mutual errors which people are facing occasionally.

Error 1 : Exception inward thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected fault launching Internet Explorer. Protected Mode settings are non the same for all zones. Enable Protected Mode must hold out laid to the same value (enabled or disabled) for all zones. (WARNING: The server did non render whatever stacktrace information).

Error 2 : Exception inward thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected fault launching Internet Explorer. Browser zoom score was laid to 200%. It should hold out laid to 100% (WARNING: The server did non render whatever stacktrace information).

Solution to resolve inward a higher house errors Is every bit bellow.

Solution To Resolve Error 1 : Enable protected manner for all zones
You ask to enable protected manner for all zones from Internet Options -> Security tab. To enable protected manner for all zones
  1. Open Internet Explorer browser.
  2. Go to carte Tools -> Internet Options.
  3. Click on Security tab.
  4. Select Internet from "Select a zone to persuasion or modify safety settings" in addition to Select(check) cheque box "Enable Protected Mode" from In the "Security score for this zone" block every bit shown In bellow Images.
  5. Apply same affair for all other three zones -> Local Internet, Trusted Sites in addition to Restricted Sites every bit shown In bellow Images.

This setting volition resolve fault related to "Protected Mode settings are non the same for all zones."

Also yous tin plough over the sack resolve this fault on operate time. View THIS POST for detailed description in addition to example.

Solution To Resolve Error 2 : Set IE browser zoom score to 100%
By default, IE browser's zoom score volition hold out 100%. But If individual has changed It to 200% or whatever other score thence yous volition human face upward fault during webdriver software examine execution In IE browser in addition to your examine volition fail. You ask to laid IE browser's zoom score 100%.

To Set IE browser's zoom score 100%
  1. Open Internet Explorer browser.
  2. Go to carte View -> Zoom -> Select 100% every bit shown In bellow Image.


This setting volition resolve fault related to "Browser zoom score was laid to 200%. It should hold out laid to 100%"

Also yous tin plough over the sack resolve this fault on operate time. View THIS POST for detailed description in addition to example.

Step three : Execute First WebDriver Test In Internet Explorer browser
Now yous are all laid to execute commencement selenium webdriver In IE browser. I bring created sample examine to operate examine In IE browser. Execute bellow given sample calc examine In eclipse in addition to verify Its output In console.

IEBrowserSampleTest.java
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver;  populace cast IEBrowserSampleTest {   populace static void main(String[] args) throws Exception {    // Set path of IEDriverServer.exe.   // Note : IEDriverServer.exe should hold out In D: drive.   System.setProperty("webdriver.ie.driver", "D://IEDriverServer.exe");    // Initialize InternetExplorerDriver Instance.   WebDriver driver = novel InternetExplorerDriver();    // Load sample calc examine URL.   driver.get(" ");    // Execute sample calc test.   driver.findElement(By.xpath("//input[@id='1']")).click();   driver.findElement(By.xpath("//input[@id='plus']")).click();   driver.findElement(By.xpath("//input[@id='6']")).click();   driver.findElement(By.xpath("//input[@id='equals']")).click();   String upshot = driver.findElement(By.xpath("//input[@id='Resultbox']")).getAttribute("value");   System.out.println("Calc examine upshot Is : " + result);   driver.close();  } }

At the halt of execution, console output volition hold out looks similar bellow.



More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post