Execute Method

Class

BaseState.

Action

Executes the base state on the machine as specified by the desktop.

Syntax

TestObject = BaseState.Execute()
Variable Description
TestObject The object for which the locator should wait.

Example: Specify the browser and the URL of a web application in the base state

You can use the following code to specify Internet Explorer as the browser on which a web application should be tested and www.borland.com as the URL of the web application:

Dim baseState = New BrowserBaseState(BrowserType.InternetExplorer, "www.borland.com")
baseState.Execute()

To additionally store the base state in a variable:

Dim baseState = New BrowserBaseState(BrowserType.InternetExplorer, "www.borland.com")
Dim browserApplication As BrowserApplication = baseState.Execute()

To specify a mobile browser on a mobile device, for example Safari on an iOS device, you can use the following code:

Dim baseState = New BrowserBaseState(BrowserType.Safari, "www.borland.com")
baseState.MobileDeviceName = "My iPhone"
baseState.Execute()

Example: Specify the path to the executable and a locator for the main window of the AUT

You can use the following code to specify C:/windows/system32/notepad.exe as the path to the executable of the AUT and //Window[@caption='*Notepad*'] as the locator for the main window of the AUT:

Dim baseState = New BaseState("C:/windows/system32/notepad.exe", "//Window[@caption='*Notepad*']")
baseState.Execute()

To additionally store the base state in a variable:

Dim baseState = New BaseState("C:/windows/system32/notepad.exe", "//Window[@caption='*Notepad*']")
Dim mainWindow As Window = baseState.Execute()