To verify the clipboard contents, you can check the Sys.Clipboard
property value.
Creating Clipboard Checkpoints at Design Time
The Clipboard Checkpoint item of the Tools toolbar that generates script code performing comparison at design time does not work for keyword tests. To add a clipboard content check to your keyword tests, you can use the If… Then operations.
-
Open your keyword test for editing.
-
Add the If... Then operation to the test. After you dragged the operation from the Operations list to the test in the Keyword Test editor, TestComplete will display the Operation Parameters dialog in which you can specify the condition to be checked by the operation.
-
Specify the following values in the dialog:
-
In the Value1 band
- Specify Code Expression in the Mode column.
- Enter
Sys.Clipboard
in the Value column.
-
In the Condition column specify the desired comparison condition, for instance, equal to.
-
In the Value2 band you can specify the desired value. For instance, to specify text:
- Specify Constant in the Mode column.
- Select String in the Type column.
- Enter the desired text into the Value column.
-
-
Click OK to close the dialog and to save the changes.
The If... Then operation that we added to the keyword test will compare the clipboard contents against the value that you specified in the Value2 band. If the condition evaluates to True, TestComplete will execute child operations of the If... Then operation. If you have the Else operation that follows If... Then in the test, the child operations of this Else operation will be executed when the condition evaluates to False.
Creating Clipboard Checkpoints During Test Recording
To add a clipboard content check to your keyword test during test recording, use the Clipboard Checkpoint item of the Recording toolbar. It calls the Create Clipboard Checkpoint dialog that allows specifying checkpoint comparison conditions and the text against which the clipboard content will be compared. When you click OK in the dialog, TestComplete automatically adds operations that call the generated comparison script code to your keyword test.
See Also
About Clipboard Checkpoints
Creating Clipboard Checkpoints in Scripts
If... Then Operation
Else Operation