Exists Method

Class

AnyWin class.

Action

Tests whether a window exists.

Syntax

bDoesExist = window.Exists ([nTimeout])
Variable Description
bDoesExist Whether the window exists. BOOLEAN.
nTimeout Optional: The seconds for Silk Test Classic to wait for the window to exist (the default is 0). NUMBER.

Notes

  • Exists returns TRUE if the window exists before the nTimeout seconds elapse, or FALSE if the window does not exist. The window does not have to be active, enabled, or exposed for it to exist. If you specify nTimeout, Exists waits up to the specified number of seconds for the window to exist.

  • Exists does not raise an error if the window does not exist. To check whether or not a window exists and to raise an error if it does not, use Exists with the Verify function, as shown below:
    Verify (SaveMessage.Exists (5), TRUE) 
  • Exists should always be part of another statement, so that the value returned by Exists is used.

  • If the window is not unique, Silk Test Classic raises the E_WINDOW_NOT_UNIQUE exception, unless the OPT_VERIFY_UNIQUE option is set to FALSE.

  • If you set the OPT_MENU_PICK_BEFORE_GET option to TRUE, you may see menus pop up on the screen when calling Exists on a menu item, even though your code does not explicitly call Pick.

Example

	[ ] TextEditor.File.New.Pick () 
	[-] if (SaveMessage.Exists (5)) 
		[ ] SaveMessage.Dismiss ()