Running Selenium WebDriver in Google Chrome Browser using Chrome Driver - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Saturday 29 November 2014

Running Selenium WebDriver in Google Chrome Browser using Chrome Driver

Hi Reader,
We can run the Selenium WebDriver tests in Google Chrome browser using capabilities to perform automation testing.


To Run Selenium test in Chrome Browser you will need to the latest Chrome Driver from the following location:


http://chromedriver.storage.googleapis.com/index.html


import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Chrome{


public static void main(String[] args) { 


File chromeDriver = new File("<Path to IE Driver exe>\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver", chromeDriver.getAbsolutePath() );
WebDriver    driver = new ChromeDriver();
driver.get("http://bugreaper.blogspot.in/");
driver.quit();
 

}
}

No comments:

Post a Comment