We can also run the Selenium Webdriver programs in Internet Explorer web browser using capabilities to perform automation testing.
To run the Selenium Webdriver programs in Internet Explorer web browser we need to download IE Driver
Here is the very basic program to run Selenium Webdriver programs in Internet Explorer web browser using capabilities.
Detailed explanation for the above program is as follows:
Following code is the required packages for Java File.
Following code is the required packages for Selenium Webdriver.
Following code is the required packages for IE browser and Selenium remote capabilities.
Following code is to initialize the webdriver.
Following code is to locate the ie driver executable file.
Following code is to set the ie driver with webdriver property.
Following code is to define Internet Explorer capability.
Following code is to set Internet Explorer capability.
Following code is to initialize the ie driver.
Following code is to open the hello selenium blog in ie browser.
You can also use the following code is to open the hello selenium blog in browser.
Following code is to quit the driver instance.
You can also use the following code is to close the driver instance.
To run the Selenium Webdriver programs in Internet Explorer web browser we need to download IE Driver
Here is the very basic program to run Selenium Webdriver programs in Internet Explorer web browser using capabilities.
Java Source code:
package com.helloselenium.selenium.test; import java.io.File; import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities; public class OpenHelloSeleniumBlogInInternetExplorer{ public static void main(String[] args) { WebDriver driver = null; File IEDriver = new File("path of the IEDriverServer (.exe file)"); System.setProperty("webdriver.ie.driver", IEDriver.getAbsolutePath() ); DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability(InternetExplorerDriver. INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true); driver = new InternetExplorerDriver(capabilities); driver.get("http://helloselenium.blogspot.com"); driver.quit(); } }
Detailed explanation for the above program is as follows:
Following code is the required packages for Java File.
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.DesiredCapabilities;
Following code is to initialize the webdriver.
WebDriver driver = null;
File IEDriver = new File("path of the IEDriverServer (.exe file)");
System.setProperty("webdriver.ie.driver", IEDriver.getAbsolutePath() );
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver. INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
driver = new InternetExplorerDriver(capabilities);
driver.get("http://helloselenium.blogspot.com");
driver.navigate().to("http://helloselenium.blogspot.com");
driver.quit();
driver.close();
0 Comments
What would you like to add in my list? I look forward to reading your comments below.