If you are testing a web application on a WebDriver-based browser, you can customize and configure the browser session by setting the capabilities.
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 Silk4NET:
For additional information, see Base State.
' VB .NET code - No linebreaks, this is a single line of code. baseState.ConnectionString = "moz:firefoxOptions={\"prefs\": { \"browser.download.folderList\": 2, \"browser.helperApps.neverAsk.saveToDisk\": \"application/octet-stream\"}};"
// C# code - No linebreaks, this is a single line of code. baseState.ConnectionString = "moz:firefoxOptions={\"prefs\": { \"browser.download.folderList\": 2, \"browser.helperApps.neverAsk.saveToDisk\": \"application/octet-stream\"}};";
' VB .NET code baseState.ConnectionString = "moz:firefoxOptions={\"prefs\": { \"browser.download.dir\" : \"C:/Download\"}};"
// C# code baseState.ConnectionString = "moz:firefoxOptions={\"prefs\": { \"browser.download.dir\" : \"C:/Download\"}};";
' VB .NET code baseState.ConnectionString = "moz:firefoxOptions={\"args\":[\"--devtools\"]};"
// C# code baseState.ConnectionString = "moz:firefoxOptions={\"args\":[\"--devtools\"]};";
' VB .NET code - No linebreaks, this is a single line of code. baseState.ConnectionString = "chromeOptions={\"prefs\": {\"profile.default_content_setting_values.automatic_downloads\":1, \"download.default_directory\":\"c:/Download\", \"download.prompt_for_download\":false}};"
// C# - No linebreaks, this is a single line of code. baseState.ConnectionString = "chromeOptions={\"prefs\": {\"profile.default_content_setting_values.automatic_downloads\":1, \"download.default_directory\":\"c:/Download\", \"download.prompt_for_download\":false}};";
' VB .NET code - No linebreaks, this is a single line of code. baseState.ConnectionString = "chromeOptions={\"args\": [\"--disable-save-password-bubble\"], \"prefs\": {\"profile.password_manager_enabled\":false, \"credentials_enable_service\":false}};"
// C# code - No linebreaks, this is a single line of code. baseState.ConnectionString = "chromeOptions={\"args\": [\"--disable-save-password-bubble\"], \"prefs\": {\"profile.password_manager_enabled\":false, \"credentials_enable_service\":false}};";