On-Screen Action Operation

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

Use the On-Screen Action operation to perform various actions over a window or control or obtain the window’s (or control’s) properties. When you add an operation to the keyword test, you specify the desired window or control and the method or property to be called.

Requirements

In order for you to be able to add the operation to the test, the desired window or control must exist in the system. You cannot append the operation to your test for non-existing objects.

To simulate entering text both in keyword tests and in scripts, TestComplete elevated permissions must be higher than those of the tested application. That is, if TestComplete is running under a user account, and you run the tested application with administrator privileges, TestComplete will not send test commands to the tested application. Run TestComplete as an administrator to avoid the issue.

Operation Result

The operation returns the same value, which the called method or property returns. For information on how to obtain the result value, see Checking Operation Result.

Scripting Analogue

The operation is a keyword test analogue for calling the specified method or property from a script.

Child Operations

The operation cannot have child operations.

Operation Parameters

The operation has the following parameters:

  • The window or control, with which the operation will work.

  • The name of the method or property to be called.

  • The method’s (or property’s) parameters, if any.

When you add the operation to your keyword test, TestComplete displays a wizard that lets you specify all these parameters. To modify parameters of an operation that is already added to the test, you can use special dialogs and in-place editors provided by the Keyword Test editor. These dialogs and in-place editors are analogues to the wizard’s pages.

Specifying parameters when adding the operation

The wizard, that TestComplete displays when you are adding the operation to your test, contains the following pages:

Select Object

On this page you specify the object that will work with the operation. You can select the desired object on screen, or, if the object is mapped, choose the object’s mapped name or alias. For detailed information, see Selecting Objects for Keyword Test Operations.

Specify Method or Property

On this page you can choose the method or property of the selected object. The operation will call this method (or property) to perform an action over the object or obtain information about it. For detailed information about methods and properties, see description of the object. If the method or property is provided by TestComplete, you can find the description in TestComplete help (see Searching for Information).

Note: If the selected object is a name mapping item or alias and the underlying test object does not exist, then by default the page will contain only those methods and properties that are available to name mapping items or aliases. You can view and select methods and properties of the underlying test object only if this object exists. You can also view and select these methods and properties for those objects that were mapped in a specific way. For more information about this, see Saving Information on Methods and Properties of Mapped Objects.

Actually, the object that you are exploring on the Specify Method or Property page and the Aliases tree on the Select Object page can contain a number of properties, fields, methods, events and name aliases. It may be inconvenient to search for an item that has a great number of them. Quick Search simplifies searching for certain items on these pages. It filters out the items of the currently open page according to the text that you are typing in the Quick Search edit box. To remove the filter, erase the text you have typed, or just press the button.

Operation Parameters

On this page you specify the parameters of the method (or property) that will be called by the operation. For information on the parameters, see the method (or property) description. If the method or property is provided by TestComplete, you can find the description by searching for the method (or property) name in TestComplete help file (see Searching for Information).

For more information on setting the values on the page, see Specifying Operation Parameters.

Modifying Parameters

After adding the operation to the test, you can modify the operation parameters with the same wizard that you used to add the operation. To invoke the wizard, simply double-click the operation’s row in the Keyword Test editor.

To modify parameters of the operation, you can also use the in-place editors and dialogs provided by the Keyword Test editor.

To specify another object:

  • Select the operation in the test.

  • Click within the Item cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Click the ellipsis button within the in-place editor. This will invoke the Select Object dialog that is similar to the Select Object page of the wizard that was displayed when you added the operation to the test (see above).

  • Use the Select Object dialog to specify the desired object. Click OK to close the dialog.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

To choose another method or property to be called by the operation:

  • Select the operation in the test.

  • Click within the Operation cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Select the desired property or method from the drop-down list.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

To specify the method or property parameters:

  • Select the operation in the test.

  • Click within the Value cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Click the ellipsis button of the in-place editor. This will invoke the Operation Parameters dialog, in which you can specify the parameters. For detailed information on the parameters, see description of the method or property, to which the parameters belong.

  • Click OK in the dialog to save the changes.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

Remarks

When you add the operation to test, TestComplete also appends grouping nodes that correspond to the process and window, to which the specified onscreen object belongs.

To highlight this object on screen, right-click the operation in the Keyword Test editor and choose Highlight on Screen from the context menu. If the window (or control) exists, TestComplete will highlight it with a red rectangle. Note that to highlight an element of a web page, you may need to set the page’s zoom ratio to 100%. Else, the test engine will fail to determine the element’s coordinates correctly. See Preparing Web Browser.

You can add an On-Screen Action operation that works with the same object as an existing On-Screen Action operation. To do this, right-click the exiting On-Screen Action operation in the Test Steps page of the Keyword Test editor and choose Add Operation With Same Target Object from the context menu. Then click within the test to specify the position of the new operation. TestComplete will display the Operation Parameters wizard in which you can specify the parameters of the new On-Screen Action operation.

See Also

Test Actions Category
Specifying Operation Parameters
Selecting Objects for Keyword Test Operations
Checking Operation Result
Call Object Method Operation
Run Code Snippet Operation
Calling Methods and Properties of "Internal" Objects

Highlight search results