While Loop Operation

Applies to TestComplete 15.64, last modified on June 12, 2024


The While Loop operation executes child operations while the condition, specified by the operation parameters, is True.

Operation Result

The operation does not return any value.

Scripting Analogue

The While Loop operation is analogue to the while statement of Visual Basic, JavaScript, C++, Delphi and other languages.

Child Operations

The While Loop operation can have any operation as a child.

For information on how to make an operation a child of another operation, see the description of the Keyword Test editor’s Test Steps page.

Operation Parameters

The operation has only one parameter: the condition to be checked on each iteration. You specify this condition in the Operation Parameters dialog:

Parameters of the While Loop Operation

The condition may contain one or several comparison expressions. In the last case, the expressions are combined with each other with the AND and OR operators.

Each row in the dialog corresponds to a comparison expression. The expression has two operands (Value 1 and Value 2) and the comparison operator between them. To specify the operator, simply select the desired value from the drop-down list of the Condition column.

To specify values

To specify the values (operands), use the Value 1 and Value 2 columns. To specify the value, click the ellipsis button of the appropriate cell. This will invoke the Edit Value dialog in which you can specify the desired data.

Each value can be specified in one of the following modes:

  • Constant
  • Expression
  • Variable
  • Test Parameter
  • Last Operation Result
  • Onscreen Object

The values are specified in the same manner, in which you specify operation parameters. See Specifying Operation Parameters for detailed information.

To add an expression

All the expressions that make up the condition are combined with each other with the AND or OR operators. To add a new expression to the condition:

  • Select the expression, with which a new expression will be combined.

  • Click And or Or to specify the desired operator. The row for the new expression will be displayed in the Operation Parameters dialog.

  • Specify the expression’s values and condition.

To delete an expression
  • Select the desired expression in the dialog.

  • Click Remove.

To delete all the expressions, press Clear.


The While Loop operation works until the specified condition evaluates to False. You can exit the loop earlier by using the Go to Label operation.

See Also

Statements Category
Specifying Operation Parameters
For Loop Operation

Highlight search results