While...Wend Statement

Relevant for: GUI actions, scripted GUI components, and function libraries

A While...Wend statement instructs UFT to perform a statement or series of statements while a condition is true. It has the following syntax:

While condition
	statement
Wend

Item

Description

condition

A condition to be fulfilled.

statement

A statement or series of statements to be executed during the loop.

Example: In the following example, UFT performs a loop using the While statement while the number of passengers is fewer than ten. Within each loop, UFT increments the number of passengers by one:

passengers = Browser("Mercury Tours").Page("Find Flights").WebEdit("numpassengers").GetROProperty("value")
While passengers < 10
	passengers = passengers + 1
Wend
msgbox("The number of passengers in the party is " & passengers)