ClearTrap Method

Class

AnyWin class.

Action

Removes a trap set for the window.

Availability

This functionality is supported only if you are using the Classic Agent.

Syntax

window.ClearTrap ( )

Notes

ClearTrap removes a trap set with SetTrap. The trap detects when the window comes into existence. In the example below, the trap presses the OK button when the window appears. After the call to ClearTrap, Silk Test Classic no longer watches for the window.

If there is not already a trap set with SetTrap for the current window, Silk Test Classic raises the exception E_TRAP_NOT_SET.

Example

// set a trap on the SaveMessage dialog box
SaveMessage.SetTrap ("OK")
// open a new file (may display SaveMessage)
TextEditor.File.New.Pick ()
// remove the trap
SaveMessage.ClearTrap ()