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
Validate.NotExists works differently than expected
-
- Posts: 44
- Joined: Fri Oct 26, 2007 1:18 pm
Re: Validate.NotExists works differently than expected
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?
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...
Ciege...
Re: Validate.NotExists works differently than expected
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 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...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Validate.NotExists works differently than expected
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
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