Starting a Browser from a Script

Instead of selecting a browser for replay at the start of a test, you might require to start a specific browser out of the test script during replay.

Using the BrowserBaseState class

Using the BrowserBaseState class to start a browser out of a test script ensures that the browser that is specified by the Executable property is running and ready for testing. The base state additionally navigates to the URL that is specified by the Url property and brings the browser to the front.

The following code sample uses the BrowserBaseState class to start Internet Explorer.
' VB . NET code
Dim MyBrowserBaseState As New BrowserBaseState(BrowserType.InternetExplorer, "http://www.borland.com")
MyBrowserBaseState.Execute()

Using multiple instances of a browser

If you have more then one browser windows or tabs open, Silk4NET handles each browser window or tab as a distinct object with a unique locator. The locators are indexed, for example WebBrowser , WebBrowser[1] , WebBrowser[2] , and so on.