selenium.webdriver.common.desired_capabilities

The Desired Capabilities implementation.

class selenium.webdriver.common.desired_capabilities.DesiredCapabilities[source]

Set of default supported desired capabilities.

Use this as a starting point for creating a desired capabilities object for requesting remote webdrivers for connecting to selenium server or selenium grid.

Usage Example:

from selenium import webdriver

selenium_grid_url = "http://198.0.0.1:4444/wd/hub"

# Create a desired capabilities object as a starting point.
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities['platform'] = "WINDOWS"
capabilities['version'] = "10"

# Instantiate an instance of Remote WebDriver with the desired capabilities.
driver = webdriver.Remote(desired_capabilities=capabilities,
                          command_executor=selenium_grid_url)

Note: Always use ‘.copy()’ on the DesiredCapabilities object to avoid the side effects of altering the Global class instance.

ANDROID = {'version': '', 'browserName': 'android', 'platform': 'ANDROID'}
CHROME = {'version': '', 'browserName': 'chrome', 'platform': 'ANY'}
EDGE = {'version': '', 'browserName': 'MicrosoftEdge', 'platform': 'WINDOWS'}
FIREFOX = {'browserName': 'firefox', 'acceptInsecureCerts': True, 'marionette': True}
HTMLUNIT = {'version': '', 'browserName': 'htmlunit', 'platform': 'ANY'}
HTMLUNITWITHJS = {'version': 'firefox', 'browserName': 'htmlunit', 'platform': 'ANY', 'javascriptEnabled': True}
INTERNETEXPLORER = {'version': '', 'browserName': 'internet explorer', 'platform': 'WINDOWS'}
IPAD = {'version': '', 'browserName': 'iPad', 'platform': 'MAC'}
IPHONE = {'version': '', 'browserName': 'iPhone', 'platform': 'MAC'}
OPERA = {'version': '', 'browserName': 'opera', 'platform': 'ANY'}
PHANTOMJS = {'version': '', 'browserName': 'phantomjs', 'platform': 'ANY', 'javascriptEnabled': True}
SAFARI = {'version': '', 'browserName': 'safari', 'platform': 'MAC'}

This Page