Saturday, December 30, 2017
WebDriver Launch multiple Browsers Firefox Chrome IE Opera and open the websites
WebDriver Launch multiple Browsers Firefox Chrome IE Opera and open the websites
How to Launch Browsers Firefox, Chrome, IE, Opera and open the websites using Selenium WebDriver.
Launch_Multiple_Browsers_Open_Site.java
Steps:
- � Define Firefox Browser and open the Firefox Browser
- � Open the URL (Website)
- � Get on IMAGE LINK like button using By.xpath
- � Get on WEBLINK using By.linktext
Selenium Code:
package Selenium_WebDriver;
import org.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.chrome.ChromeDriver;
importorg.openqa.selenium.firefox.FirefoxDriver;
importorg.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.opera.core.systems.OperaDriver;
public classLaunch_Multiple_Browsers_Open_Site {
public static void main(String[] args) throws InterruptedException {
//Define Firefox Browser as webdriver and open the Firefox Browser
WebDriver firefoxDriver = new FirefoxDriver();
// Open the URL (Website) in Firefox
firefoxDriver.get("http://google.co.in");
//Set system property for Chrome Browser after download the ChromeDriver
System.setProperty("webdriver.chrome.driver", "E:Selenium Training by RajeshDriverServerchromedriver.exe");
//Define Chrome Browser as webdriver and open the Chrome Browser
WebDriver chromeDriver = new ChromeDriver();
// Open the URL (Website) in Chrome
chromeDriver.get("http://seleniumhq.org");
//Set system property for IE Browser after download the IEDriver (PS: Set Same Security level in all zones under IE tool option)
System.setProperty("webdriver.ie.driver", "E:Selenium Training by RajeshDriverServerIEDriverServer.exe");
//Define IE Browser as webdriver and open the IE Browser
WebDriver IEDriver = new InternetExplorerDriver();
//Open the URL (Website) in IE
IEDriver.get("http://seleniumhq.org");
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.