Setting Capabilities for WebDriver-Based Browsers

If you are testing a web application on a WebDriver-based browser, you can customize and configure the browser session by setting the capabilities.

In Silk Test Classic, you can specify WebDriver capabilities in the connection string for the following browser types:
  • Google Chrome
  • Mozilla Firefox

For information on the available options and capabilities for Mozilla Firefox 48 or later, see https://github.com/mozilla/geckodriver. For information on the available options and capabilities for Google Chrome, see Capabilities & ChromeOptions.

To set the capabilities in Silk Test Classic:

  1. Select the project which corresponds to the web application for which you want to change the capabilities.
  2. Edit the connection string in the base state of the project. You can edit the connection string in the following ways:
    • By using the Edit Application Configurations dialog, for example if you want to record actions against a customized browser.
    • In a script, if you only want to execute the tests in the script against the customized browser.

    For additional information, see Modifying the Base State (Open Agent).

  3. Execute the script to start the browser with the specified options and capabilities.

Examples

You can add the following code to the base state in a script to automatically download executables from Mozilla Firefox:
STRING sConnectionString = "moz:firefoxOptions="{""prefs"": "{ ""browser.download.folderList"": 2, ""browser.helperApps.neverAsk.saveToDisk"": ""application/octet-stream""}}"
You can add the following code to the base state in a script to specify the download folder for Mozilla Firefox:
STRING sConnectionString = "moz:firefoxOptions="{""prefs"": "{ ""browser.download.dir"" : ""C:/Download""}}"
You can add the following code to the base state in a script to set a command line argument for Mozilla Firefox:
STRING sConnectionString = "moz:firefoxOptions="{""args"": [""--devtools""]}"
You can add the following code to the base state in a script to automatically download executables from Google Chrome to a specific folder:
STRING sConnectionString = "chromeOptions="{""prefs"": "{""profile.default_content_setting_values.automatic_downloads"":1, ""download.default_directory"":""c:/Download"", ""download.prompt_for_download"":false}}"
You can add the following code to the base state in a script to disable the password manager from showing messages in Google Chrome:
STRING sConnectionString = "chromeOptions="{""args"": [""--disable-save-password-bubble""], ""prefs"": "{""profile.password_manager_enabled"": false, ""credentials_enable_service"":false}}"