-
Notifications
You must be signed in to change notification settings - Fork 128
Override browser profile preferences, install browser extensions, Headless mode
Our framework supports overriding browser profile preferences set in DriverContext class or adding additional not included in our code, passing arguments to browsers and installing browser extensions. It can be done by adding settings in FirefoxPreferences, FirefoxArguments and FirefoxExtensions or ChromePreferences, ChromeArguments and ChromeExtensions sections of App.config file.
<?xml version="1.0" encoding="utf-8"?>
<configSections>
<section name="FirefoxPreferences" type="System.Configuration.NameValueSectionHandler"/>
<section name="FirefoxExtensions" type="System.Configuration.NameValueSectionHandler"/>
<section name="FirefoxArguments" type="System.Configuration.NameValueSectionHandler"/>
<section name="ChromePreferences" type="System.Configuration.NameValueSectionHandler"/>
<section name="ChromeExtensions" type="System.Configuration.NameValueSectionHandler"/>
<section name="DriverCapabilities" type="System.Configuration.NameValueSectionHandler"/>
<section name="ChromeArguments" type="System.Configuration.NameValueSectionHandler"/>
<section name="InternetExplorerPreferences" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
...
<FirefoxPreferences>
<add key="PreferenceToBeOverride" value="NewValue" />
</FirefoxPreferences>
<FirefoxExtensions>
<add key="FirefoxPluginName.xpi" value=""/>
</FirefoxExtensions>
<ChromePreferences>
<add key="PreferenceToBeOverride" value="NewValue" />
</ChromePreferences>
<ChromeExtensions>
<add key="ChromePluginName.crx" value=""/>
</ChromeExtensions>
<ChromeArguments>
<add key="--headless" value=""/>
</ChromeArguments>
<InternetExplorerPreferences>
+ <add key="EnsureCleanSession" value="false"/>
+ </InternetExplorerPreferences>
</configuration>
To pass arguments to Chrome browser to e.g. start in headless mode add this section to your App.config file
<ChromeArguments>
<add key="--headless" value=""/>
</ChromeArguments>
To start e.g. FireFox with FireBug extension copy firebug-x.x.x-fx.xpi file to bin folder of your project and add this section to your App.config file
<FirefoxExtensions>
<add key="firebug-2.0.19-fx.xpi" value=""/>
</FirefoxExtensions>
To overwrite any e.g. Firefox preferences or add new one add this section to your App.config file
<FirefoxPreferences>
<add key="network.automatic-ntlm-auth.trusted-uris" value="servername1,servername2" />
</FirefoxPreferences>
With the InternetExplorer you can only override EnsureCleanSession and IgnoreZoomLevel preferences, by default both are set to true in DriverContext class.
In order to start FireFox with default firefox profile edit following section in your App.config file, set proper path to FireFox default profile.
<!--Use default firefox profile?-->
<add key="UseDefaultFirefoxProfile" value="true"/>
<add key="PathToFirefoxProfile" value="C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles"/>
- Home
- Getting started
- Parallel tests execution
- MsTest DataDriven tests from Xml and CSV files
- NUnit DataDriven tests from Xml, CSV and Excel files
- Comparing files by NUnit DataDriven tests
- Visual Testing
- Screen shots: full desktop, selenium. PageSource saving
- Verify-asserts without stop tests
- Downloading files
- Helpers
- Override browser profile preferences, install browser extensions, Headless mode
- Debugging Test.Automation framework
- Logging
- Performance measures
- Webdriver Extends
- More common locators
- Selenium-Grid-support
- Advanced Browser Capabilities and Options
- AngularJS synchronization
- Update App.config or appsettings.json
- Cross browser parallel test execution with testing-Cloud-Providers\SeleniumGrid
- Verifying Javascript Errors from browser
- Enabling Performance Log for Chrome
- Azure DevOps Support
- Edge browser Support
- Downloading and running Selenium Grid with Powershell
- Run Ocaramba tests with Docker container
- HTTP auth in Internet explorer
- ExtentReports Support