Desired Capabilities in selenium

capabilitiesIn_SeleniumWebDriverDesiredCapabilities describe a series of key/value pairs that encapsulate aspects of a browser, 
Basically this is used to set certain properties of browser for the WebDriver.

Properties such as:
  • set the path of the browser if not installed in default location.
  • set the browser Version, Browser Name, platform (Normally we use in selenium GRID)
  • to set the firefox profile
  • configurations related to browser cookies, SSL security popups,

Let’s see some of the implementation of DesiredCapabilities in selenium:
A part of the code to set browser, platform and version:





Disable application cache:

 

Set firefox profile through code :


Refer firefox profile and it’s preferences for more information.

Set firefox installation path, if not on default path:

 

Through DesiredCapabilities, we can set ChromeOptions (setting ChromeDriver-specific capabilities)
Example of setting ChromeOptions,
Some times we get certificate error while launching Chrome browser using selenium webDriver
error:You are using unsupported command-line flag..

unsupported command-line flag_Chrome

To get rid of the error banner on Chrome-

Content posted is based on learning or working experience, Share the post with others if find useful, Any queries?, leave comments or discuss on our facebook:qavalidation.com, Thanks!

1 Response

  1. July 13, 2016

    […] desiredCapabilities in selenium to understand above […]

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: