Friday, 22 May 2015

Selenium Webdriver Capabilities significance

Java Context

In Selenium, we have a Webdriver Interface and there are lot of classes that implement this interface.
So let us first try to understand this interface.

What is inside this WebDriver Interface?
Important methods declared inside this interface are -
  1. get
  2. findElement
  3. getTitle
  4. getPageSource....etc
The classes that implement this interface are given below.
  1. ChromeDriver
  2. EventFiringWebDriver
  3. FirefoxDriver
  4. HtmlUnitDriver
  5. InternetExplorerDriver
  6. OperaDriver
  7. RemoteWebDriver
  8. SafariDriver

Now let us take a look at different constructors for ChromeDriver.

  1. ChromeDriver()
  2. ChromeDriver(Capabilities capabilities)
  3. ChromeDriver(ChromeDriverService service)
  4. ChromeDriver(ChromeDriverService service, Capabilities capabilities)
  5. ChromeDriver(ChromeDriverService service, ChromeOptions options)
  6. ChromeDriver(ChromeOptions options)
As you can see, in Java Selenium API, we have 6 constructors for the ChromeDriver class.
The first constructor takes no arguments. But rest of them are taking the arguments as mentioned below.
  1. Capabilities
  2. ChromeDriverService
  3. ChromeOptions

Now let us try to understand the significance of these classes.

Capabilities are used to manage the browser attributes. For example - we can set the browser name, version, platform using capabilities.
ChromeDriverService is used to manage the chrome server (exe). Finally, ChromeOptions are used to set the options specific to the chrome browser like adding extensions, setting the binary path etc.

Constructors for other classes also take similar arguments as mentioned above.

Capabilities used by Selenium Server

  1. browserName - chrome|firefox|internet explorer|htmlunit|android|iPhone|iPad|opera|safari
  2. version
Some other important Capabilities
  1. acceptSslCerts
  2. nativeEvents
  3. proxy
IE specific Capabilities
  1. ignoreZoomSetting
  2. ie.ensureCleanSession
Firefox specific Capabilities
  1. firefox_binary
You can find more information on the link -

What do you think on above selenium topic. Please provide your inputs and comments. You can write to me at

1 comment:

Buy Best Selenium Books