Our vBulletin migration is complete.
Welcome vBulletin users! All content and user information from the Micro Focus Forums (vBulletin) site has been migrated to this site. READ MORE.
JonathanPhillips Absent Member.
Absent Member.

I have disabled the option to execute base state and I want to be able to control which browser is ran at runtime.


Essentially I have a script that is ran with these beginning instructions because it is necessary for what is being tested:


Dim baseState As New BrowserBaseState(BrowserType.GoogleChrome, "website path")

baseState.CommandLineArguments = "-disable-print-preview"


I would like to be able to have a switch mechanism so I am able to use the same script and choose a different browser at the select browser stage (chrome Firefox etc) and at runtime I am able to execute that browser that was chosen. I do not know if the browser you select at the select browser dialog has a name so I'm able to make that call in my script to make a 'switch' call.

1 Reply
Micro Focus Frequent Contributor
Micro Focus Frequent Contributor

RE: I have disabled the option to execute base state and I want to be able to control which browser is ran at runtime.

Hi Jonathan.

If you want to be able to select your browser at runtime, you can instantiate your baseState with different BrowserType values. For instance, using a numeric variable called browser to decide which one to use:

Dim baseState As BrowserBaseState
Dim browser As Integer = 1

Select Case browser
    Case 1
       baseState = New BrowserBaseState(BrowserType.GoogleChrome, "www.microfocus.com")
    Case 2
       baseState = New BrowserBaseState(BrowserType.Edge, "www.microfocus.com")
    Case 3
       baseState = New BrowserBaseState(BrowserType.Firefox, "www.microfocus.com")
    Case Else
       baseState = New BrowserBaseState(BrowserType.InternetExplorer, "www.microfocus.com")
End Select


Keep in mind that every browser can accept different command line arguments, so you better set them inside the Case statement. For instance, Internet Explorer only accepts about eight different arguments and it will interpret anything else as the url that it has to open, instead of just ignoring the unknown option.

These are the valid browser types as of Silk Test 19.0:


The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.