Course Content
Selenium Python First Script
Selenium Python First Script
0/2
HTML Form elements
HTML Form elements
0/1
Handle HTML Frames
Handle HTML Frames
0/2
Handling Dropdown Lists
Handling Dropdown Lists
0/2
Selenium Action class
Selenium Action class
0/1
Selenium Python for Beginners [ 2024 ]
About Lesson

Desired capabilities

In Distributed testing using Selenium Grid, the test sends a request to the hub to create a session or test slot on the node. Desired capabilities allow you to define the browser configuration and the remote WebDriver instance. This can include browser-specific settings, platform information, and other configurations necessary to control the browser.

Some important desired capabilities are as follows:

Browser Name: Specify the browser in which tests will be executed.
Browser Version: Specify the browser version.
Platform: Specify the operating system where the tests will run.
Browser-Specific Options

Example

When running tests on Selenium Grid, you need to specify the desired capabilities for the browser and the platform on which the tests should run.

capabilities = DesiredCapabilities.CHROME.copy()
capabilities['browserName'] = 'chrome'

self.driver = webdriver.Remote(command_executor=remote_url,
desired_capabilities=capabilities)<br />

Desired capabilities are set as key-value( KV ) pairs. For example, To route the test to the Chrome node, you can set it to:

desired_capabilities = {

           “browserName”:”chrome” }

To route the test to the Firefox node, you can set it to:

desired_capabilities = {

              “browserName”:”firefox” }

Join the conversation