Get your 6-month No-Cost Opt-Out offer for Unlimited software automation!

Method Exist

Checks if the object exists in the AUT

Usage

Function Exist( 
        Long MsTimeOut [Optional],
        Boolean Report [Optional]
)

Parameters

MsTimeOut (optional)

Type: Long

Default Value: Global timeout value (from ZAPTEST Options)

How long to look for object before failing in milliseconds

Report (optional)

Type: Boolean

Default Value: True

Generate report for this step

Returns

True if object exist; otherwise, false

Example

VBScript

If Application("Demo").View("DemoView").Object("DemoObject").Exist Then
    ' Success, move on. Search for other object, but disable report generation and set time out
    Application("Demo").View("DemoView").Object("DemoObject2").Exist 10000, false
    ' If object will not found test execution will be continued
Else
    ' Generate error report
    Application("Demo").CustomReport false, "Cannot find the DemoObject", "Test failed"
End If

JavaScript

if (Application("Demo").View("DemoView").Object("DemoObject").Exist()) {
    // Success, move on. Search for other object, but disable report generation and set time out
    Application("Demo").View("DemoView").Object("DemoObject2").Exist(10000, false);
    // If object will not found test execution will be continued
} else {
    // Generate error report
    Application("Demo").CustomReport(false, "Cannot find the DemoObject", "Test failed");
}

Documentation Categories

ZAPTEST

FARM

LOAD