Testing Browser Options

Provar supports the testing of different browser options in Chrome and Firefox (Firefox browser preferences are supported as of Provar version 1.9.6). This is useful for testing different browser settings such as locale and language as well as running headless in Chrome. Note that as of Provar version 1.9.8, you can run tests headlessly in Chrome by selecting this in the Web Browser dropdown in the menubar of Provar Desktop. Refer to Headless Testing for more information.

In general Provar supports any applicable Chrome or Firefox browser preference. Refer to Chromium Command Line Switches for more information on Chrome options or refer to MozillaZine’s article on about:config entries for a full list of Firefox browser preferences and their syntax.
See the examples below for more information.

Setup

To test different browser options in Chrome and Firefox, start by adding a corresponding environment variable in Provar Desktop.

To add this environment variable, navigate to the Test Settings view and click the on the Variables subtab. Add a new Variable by clicking the ‘+’ (New) icon:

On the Variable details screen, you will then enter a name for the variable. This should be _chromeOptions if you are defining a Chrome browser preference or  _firefoxProfilePrefs if you are defining a Firefox browser preference.

Once you have set the Variable Name you can then click ‘OK’ to save the empty variable or refer to one of the examples below to configure the variable for your use case.

Example 1: Running Chrome in Headless

The example below shows how to configure a _chromeOptions variable to run tests headless using Chrome. Note that as of Provar version 1.9.8, you can run tests headlessly in Chrome by selecting this in the Web Browser dropdown in the menubar of Provar Desktop. Refer to Headless Testing for more information.

On the Variable details screen, locate your _chromeOptions variable and edit it. If you do not have a _chromeOptions variable, create it now using the steps described in the Setup section above.

On the edit Variable screen for your _chromeOptions variable, set the the Default Value to ‘–headless’:

Click the ‘OK’ button to save this change.

To test these settings, make sure that the Web Browser is set to Chrome in the top-right of Provar Desktop:

Once this is configured, click the ‘Run’ or ‘Debug’ button to execute tests as usual but without launching the Chrome browser:

Note that, if you are running in Test Builder mode, the Chrome browser will ignore any headless setting and launch Chrome browser as usual:

In general Provar supports any applicable Chrome browser preference. Refer to Chromium Command Line Switches for more information on Chrome options. Additional preferences can be added to the _chromeOptions variable using a comma-separated list.

Note that if you are running tests using ANT, the Chrome browser should also be specified to make sure that these settings are applied:

Refer to ANT Task Parameters for more information.

Example 2: Running Chrome in Spanish

The example below shows how to configure the _chromeOptions variable to set the browser language preference to Spanish.

On the Variable details screen, locate your _chromeOptions variable and edit it. If you do not have a _chromeOptions variable, create it now using the steps described in the Setup section above.

On the edit Variable screen for your _chromeOptions variable, set the the Default Value to ‘–lang=es’:

Click the ‘OK’ button to save this change.

To test these settings, make sure that the Web Browser is set to Chrome in the top-right of Provar Desktop:

Running tests in Chrome will then launch the browser in Spanish. Note that, if testing Salesforce pages, the language rendered by Salesforce is based on the user’s locale settings and not the browser language settings.

In general Provar supports any applicable Chrome browser preference. Refer to Chromium Command Line Switches for more information on Chrome options. Additional preferences can be added to the _chromeOptions variable using a comma-separated list.

Example 3: Defining Firefox Browser Language

As of Provar 1.9.6 Provar also supports the ability to define Firefox browser preferences such as language.

The example below shows how to configure the _firefoxProfilePrefs variable to set the browser language preference.

On the Variable details screen, locate your _firefoxProfilePrefs variable and edit it. If you do not have a _firefoxProfilePrefs variable, create it now using the steps described in the Setup section above.

On the edit Variable screen for your _firefoxProfilePrefs variable, set the the Default Value to ‘intl.accept_languages={lang}’, replacing ‘{lang}’ with the ISO code for the langage to be tested, e.g. ‘es’. Additional preferences can be added in a comma-separated list.

Click the ‘OK’ button to save this change.

To test these settings, make sure that the Web Browser is set to Firefox in the top-right of Provar Desktop:

Running tests in Firefox will then launch the browser in the target language.

Note that, if testing Salesforce pages, the language rendered by Salesforce is based on the user’s locale settings and not the browser language settings.

In general Provar supports any applicable Firefox browser preference. Additional preferences can be added to the _firefoxProfilePrefs variable using a comma-separated list:

For a full list of browser preferences and their syntax, you can access this from the browser itself by entering ‘about:config’: