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.
RE: I have disabled the option to execute base state and I want to be able to control which browser is ran at runtime.
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
baseState = New BrowserBaseState(BrowserType.GoogleChrome, "www.microfocus.com")
baseState = New BrowserBaseState(BrowserType.Edge, "www.microfocus.com")
baseState = New BrowserBaseState(BrowserType.Firefox, "www.microfocus.com")
baseState = New BrowserBaseState(BrowserType.InternetExplorer, "www.microfocus.com")
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: