Validate.NotExists works differently than expected

Bug reports.
Marianne Jacobsen
Posts: 44
Joined: Fri Oct 26, 2007 1:18 pm

Validate.NotExists works differently than expected

Post by Marianne Jacobsen » Wed Dec 16, 2009 10:47 am

I have a scenario where I'd like to use Validate.NotExist but it works in a way that I didn't expect. This might of couse be by design but I wanted to ask anyway.

So Validate.Exists returns as soon as the control exists or times out. So I would expect Validate.NotExist to do the exact opposite - e.g. return as soon as the control does not exist (this might be right away) or time out (if the controls exists the entire timespan). But this is not how Validate.NotExist works - if the control/element doesn't exist it will wait the entire duration for the control and then return.

Hope you understand my explanation.

If this is how it's intended to behave then just ignore my post :)

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Validate.NotExists works differently than expected

Post by Ciege » Wed Dec 16, 2009 4:39 pm

I don't know exactly but I assume this is correct.
The entire AUT (or even the entire local host) need to be search for the control. This can take some time, thus checking until timeout.

Assume this. If it takes 10 seconds to find a specific control in your AUT, but Validate.NotExist just looks for 9 seconds it could return a TRUE that the control does not exist, even if it does exist. So by checking until the end of the timeout is prudent in making sure that the control does not exist and cannot be found within the timeout selected.

With Validate.Exist Ranorex only has to find the control. As soon as it does find it we have a valid state and the search can be called off immediately.

Make any sense?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Validate.NotExists works differently than expected

Post by Ciege » Wed Dec 16, 2009 4:42 pm

Just a follow up...

If you already know the RanorexPath to the object that was validated by .Exist you do not *need* to use the .NotExist method. You can write your own method that just checks the .Valid or .Visible (or some other) property of the known RanorexPath yourself. This will be a very quick check and can return true/false to you almost immediately.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Validate.NotExists works differently than expected

Post by Support Team » Thu Dec 17, 2009 4:49 pm

As Ciege already pointed out, the Validate.NotExists behavior is by design.

You can easily create your own version of NotExists by using the Adapter.TryFindSingle method without specifying a timeout, that way Ranorex will only search once for the specified element and return true if it exists, false otherwise.

Regards,
Alex
Ranorex Support Team
.
Image