You can edit the base state in a script to specify how Silk Test Workbench starts an application under test (AUT) during replay. You can specify the executable location of the AUT, the working directory, the URL and the connection string for a web application, and so on. For example, if you want to execute tests on a production web site, which have already been executed on a staging web site, you can simply change the URL in the base state and the tests are executed against the new web site.
To edit the base state in a script:
' VB code ' Go to web page 'demo.borland.com/InsuranceWebExtJS' BrowserBaseState baseState = new BrowserBaseState() ' <-- Insert your changes here! baseState.Execute()
' VB code baseState.Executable=executableFor example, to specify the Calculator, type the following:
' VB code baseState.Executable = "C:\\Windows\\SysWOW64\\calc.exe"To specify Mozilla Firefox, type the following:
' VB code baseState.Executable = "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"
' VB code baseState.CommandLineArguments = commandLineArgumentsFor example, to start Mozilla Firefox with the profile myProfile, type the following:
' VB code baseState.CommandLineArguments = "-p myProfile"
' VB code baseState.WorkingDirectory = workingDirectory
' VB code baseState.ExecutablePattern = executablePatternFor example, if you want to specify an executable pattern for the Calculator, type:
' VB code baseState.ExecutablePattern = "*\\calc.exe"
' VB code baseState.CommandLinePattern = commandLinePatternFor example, if the command line of the application ends with com.example.MyMainClass you might want to use *com.example.MyMainClass as the command line pattern:
' VB code baseState.CommandLinePattern = "*com.example.MyMainClass"
' VB code baseState.BrowserType = BrowserType.GoogleChrome
' VB code baseState.Url = urlFor example, type the following:
' VB code baseState.Url = "demo.borland.com/InsuranceWebExtJS/"
' VB code baseState.ViewportHeight = viewportHeight baseState.ViewportWidth = viewportWidth
' VB code New MobileBaseState(connectionString)For information on the connection string, see Connection String for a Remote Desktop Browser or Connection String for a Mobile Device.
' VB code baseState.ConnectionString = "moz:firefoxOptions= {\"prefs\": { \"browser.download.dir\":\"C:/Download/\"}};"For additional information, see Setting Options and Capabilities for Web-Driver Based Browsers.