BEGINNING WITH SELENIUM

The 'WebDriver' Interface

The WebDriver interface is used as a reference to its browser class. Following image is the Hierarchy of WebDriver.


  1. SearchContext is a top most interface. The methods in this will be abstract as SearchContext is an interface.
  2. WebDriver is also an interface which extends SearchContext. WebDriver has nested interfaces names Window, Navigation, Timeouts etc. These interfaces are used to perform specific operation like back(), forward() etc.
  3. RemoteWebDriver is a fully implemented class which implements Webdriver, Javascript Executor and TakesScreenshot. As this class is fully implemented class, which means it defines body for all inherited methods.
  4. Then we have browser specific driver classes like ChromeDriver(), EdgeDriver(), FirefoxDriver() etc.
To execute the tests with Mozilla Firefox browser we generally write
WebDriver driver = new FirefoxDriver();

To execute the tests with Google Chrome browser we generally write
WebDriver driver = new ChromeDriver();

To execute the tests with Internet Explorer browser we generally write
WebDriver driver = new InternetExplorerDriver();

In Selenium 2.0, Firefox driver is used to be maintained by selenium. For other browsers we download respective binaries. Download links to some important browsers are as below:
  1. Chrome Driver
  2. Internet Explorer Driver
But from Selenium 3.0, Firefox has its own driver which is GeckoDriver

Add the following set of code before instantiating WebDriver
System.setProperty("<propertyname>", "<path of the downloaded exe of the browser binaries>");

Where property name are the following:
Mozilla Firefox browser - webdriver.gecko.driver
Google Chrome browser - webdriver.chrome.driver
Internet Explorer browser - webdriver.ie.driver

Comments

Popular posts from this blog

Setting up Maven in Eclipse editor

SELENIUM