Creating Clipboard Checkpoints in Scripts

Applies to TestComplete 14.71, last modified on April 22, 2021

To create a clipboard checkpoint, you can write script code that –

  • Obtains the clipboard contents by using the Sys.Clipboard property.

  • Compares the obtained value with the desired value using the if... then statement:

    JavaScript

    if( equal(Sys.Clipboard, "My Value"))
      // Success
    else
      // Error

    JScript

    if( Sys.Clipboard == "My Value")
      // Success
    else
      // Error

    VBScript

    If Sys.Clipboard = "My Value" Then
      ' Success
    Else
      ' Error
    End If

    DelphiScript

    if Sys.Clipboard = 'My Value' then
      // Success
    else
      // Error

    C++Script, C#Script

    if( Sys["Clipboard"] == "My Value")
      // Success
    else
      // Error

You can either write the comparison code manually, or use the Clipboard Checkpoint items of the Recording or Tools toolbar. Using an item of the Recording toolbar, you create the comparison code when recording a script. Using the Tools toolbar, you create the comparison code at design time. The whole procedure includes the following steps:

  • To create a checkpoint during the script recording, select Clipboard Checkpoint from the Recording toolbar:

    Creating Clipboard Chekpoint at Recording Time

    In the ensuing Create Clipboard Checkpoint dialog, specify checkpoint comparison conditions, the text against which the clipboard content should be compared and click OK.

    TestComplete will automatically generate the comparison code and insert it into the recorded script.

  • To create the checkpoint at design time, select Clipboard Checkpoint from the Tools toolbar. If this toolbar is hidden, right-click somewhere in the toolbar area and select Tools from the ensuing context menu:

    Creating Clipboard Checkpoint at Design Time

    In the ensuing Create Clipboard Checkpoint dialog, specify checkpoint comparison conditions and the text against which the clipboard content should be compared. Click OK to proceed with creating the checkpoint.

    TestComplete will generate the comparison code and display it in the Copy Text to Clipboard dialog. You can modify the code in the dialog, if needed. Then, you can press Copy to copy the generated code to the clipboard and then paste it in your script.

See Also

About Clipboard Checkpoints
Creating Clipboard Checkpoints in Keyword Tests

Highlight search results