Selenium WebDriver – Running Tests On Various Browsers

What is WebDriver: WebDriver is an interface that is version 2.0 of selenium.

How to invoke tests on browsers? All browsers have different classes to invoke test.

All classes implement methods of WebDriver interface to enable the browsers to execute test cases.

  1. FirefoxDriver
  2. ChromeDriver
  3. InternetExplorerDriver
  4. SafariDriver
  5. OperaDriver
  6. HTMLUnitDriver
  7. RemoteWebDriver

Instantiate the webdriver

  1. WebDriver driver = new FirefoxDriver();
  2. WebDriver driver = new ChromeDriver();
  3. WebDriver driver = new InternetExplorerDriver();
  4. WebDriver driver = new SafariDriver();
  5. WebDriver driver = new OperaDriver();

For remote webdriver capabilities

URL url = new URL(“”);

DesiredCapabilities caps = DesiredCapabilities.safari();

WebDriver driver = new new RemoteWebDriver(url, caps);

Open the web application – driver.get(“”)