While...Wend Statement

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

A While...Wend statement instructs UFT One 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 One performs a loop using the While statement while the price is less than $2,000. Within each loop, UFT One increments the price by $50:

Price = Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("$1,279.00").GetTOProperty("innertext")
While Price < 2000
	Price = Price + 50 
Wend
msgbox("The Price is ")

Tip: Use the Edit > Code Snippet > While...Wend menu command to automatically insert a statement into your test.