Selecting the Browser for Test Replay

You can define the browser that is used for the replay of a test in the following ways:
  • If you execute a test from the UI of Silk4J and the Select Browser dialog box displays, the browser selected in the dialog box is used, and Silk4J ignores which browser is set in the test script.
  • If the Select Browser dialog box is disabled, because the Don't show again is checked, the application configurations in the individual test scripts determine the browser that is used to execute the tests.
    Note: To re-enable the Select Browser dialog box, click Silk4J > Edit Application Configurations and check the Show 'Select Browser' dialog before record and playback check box
  • If you execute a script from the command line or from a Continuous Integration (CI) server, specify the connection string in the application configuration of the script.

    To overwrite the browser that is specified in the application configuration, use the silktest.configurationName environment variable.

  • If you execute a test from Silk Central, create a configuration suite with a configuration for each browser that you want to test. Then specify the appropriate configuration name. For additional information, refer to the Silk Central Help.

Examples of setting the browser by using the silktest.configurationName environment variable

  • To use Internet Explorer as the browser, type:
    SET silktest.configurationName=InternetExplorer
    
    Note: Internet Explorer
  • To use Microsoft Edge as the browser, type:
    SET silktest.configurationName=Edge
    
  • To use Mozilla Firefox as the browser, type:
    SET silktest.configurationName=Firefox
    
  • To use Google Chrome as the browser, type:
    SET silktest.configurationName=GoogleChrome
    
  • To use Apple Safari on a Mac as the browser, type:
    SET silktest.configurationName=host=10.0.0.1  - Safari
    
    In this example, the host is the Mac, on which you want to test Apple Safari. The host needs to be connected as a remote location to the machine on which Silk4J is running. For additional information, see Editing Remote Locations.
  • To use Google Chrome on an Android device as the browser, use a connection string. For example, if the device ID is 11111111 and the device is connected to the remote machine with the IP address 10.0.0.1, type:
    SET silktest.configurationName="platformName=Android;deviceName=MotoG3;deviceId=11111111;host=10.0.0.1 - Chrome"
    
  • To use the Original Android Stock (AOSP) Browser on an Android device, use a connection string. For example, if the device ID is 11111111 and the device is connected to the remote machine with the IP address 10.0.0.1, type:
    SET silktest.configurationName="platformName=Android;deviceName=MotoG3;deviceId=11111111;host=10.0.0.1 - AndroidBrowser"
    
  • To use Apple Safari on an iOS device as the browser, use a connection string. For example, if the device ID is 11111111 and the device is connected to the remote machine with the IP address 10.0.0.1, type:
    SET silktest.configurationName="platformName=iOS;deviceName=iPad mini;deviceId=11111111;host=10.0.0.1"
    
    Additionally, you have to specify the browser in the application configuration.
Tip: For all examples, you can also set the browser by setting the Java System property -Dsilktest.configurationName instead of setting the environment variable silktest.configurationName. For example, to use Apple Safari on a Mac as the browser, you can also type:
-Dsilktest.configurationName=host=10.0.0.1 - Safari
To execute the tests from the command line, type:
java -cp ".…\junit.jar;….\org.hamcrest.core_1.3.0.v201303031735.jar;C:\Program Files (x86)\Silk\SilkTest\ng\JTF\silktest-jtf-nodeps.jar;….\mytests\bin" -Dsilktest.configurationName="host=10.0.0.1 - Safari" org.junit.runner.JUnitCore Tests
Tip: Open the Select Browser dialog box, for example by starting to replay or record from the Silk4J UI, to see a list of the browsers that are currently available on your system.