Tuesday, February 22, 2011

What is Exists property in QTP

You can use Exist statements to wait for a window to open or an object to appear.
E.g Browser(“x”).page(“y”).webbutton(“z”).exists

Exists returns Boolean value. Basically, it is used for user define checkpoint

E.g
if Browser(“x”).page(“y”).webbutton(“z”).exists then
            Reporter.Report ,,”pass”
            Else
            Reporter.Report ,,”Fail”
End if

Difference between Exists and Wait
Exists:   Exists will wait till timeout, if object doesn’t exist and return false and start execution
Wait: Wait will wait till default time or user specific time and start execution.

No comments: