Validation without writing to the log

Ask general questions here.
Mayra
Posts: 68
Joined: Mon Dec 16, 2013 5:27 am

Validation without writing to the log

Post by Mayra » Thu Apr 03, 2014 10:28 pm

I am not finding a way to check if an element exists without writing a failure to the log.

If something exists in my UI, I delete it, if not I dont. By no means it is a failure/error if that item exists or
not.
I can only see using Validate.Exists, which writes the result to the log, is there other method that I can use?
I basically need a boolean returned and depending on the result I go ahead and delete the item.

Thanks.

Mayra
Posts: 68
Joined: Mon Dec 16, 2013 5:27 am

Re: Validation without writing to the log

Post by Mayra » Thu Apr 03, 2014 10:37 pm

ok, I found it: <RepoItemInfo>.exists(); however, how can I modify the Duration search time out, like the way it is done in ValidateExists()?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Validation without writing to the log

Post by krstcs » Fri Apr 04, 2014 1:48 pm

You would need to change the item (and all of its parent's if you really want to shorten it) "SearchTimeout" property.

Code: Select all

Duration oldDuration = myElementInfo.SearchTimeout;

myElementInfo.SearchTimeout = new Duration(<new time in ms>);

if (myElementInfo.Exists()) {
  <do your stuff here>
}

myElementInfo.SearchTimeout = oldDuration;
Shortcuts usually aren't...