I've worked with the .Exist
method quite a bit, but I recently moved to a new project (now using a WPF application) with QTP 11 (whereas previously I had QTP 10).
Now I'd like to check that a message does not exist by using object.Exist(2)
. Weirdly, I only get a result after ~23 seconds, instead of the 2 seconds I was expecting.
How does the timeout work? In previous projects, using object.Exist(2)
would wait 2 seconds before determining that the object didn't exist. The QTP help file also says it should only wait for 2 seconds (the specified timeout parameter).
Now, it seems as though it's waiting for the Timeout Parameter (2 seconds) AND Object Synchronization Timeout (20 seconds).
Also, Smart Identification is disabled, so it shouldn't be waiting for that. Highlighting the object using the Object Repository instantly says the object doesn't exist.
Has the timeout behavior changed between QTP v10 and v11? Why does it take so long to say an object doesn't exist?
The Exist method does not work for the last object only. It works hierarchically - which means this method checks each parent object before checking the last one. The timeout only works for the last object. if you want to receive the answer immediately, I suggest you use the following code-
if WPFWindow("x").Exist(0) Then
if WPFWindow("x").WPFButton("y").Exist(0) Then
'action
End if
End if
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With