Page 1 of 1

How to use RepoItemInfo.Exists()?

Posted: Tue Jul 05, 2011 11:43 pm
by Pixi6s
Searching the forums for the C#/Ranorex equivalent to "if exist" it comes up with the TryFindSingle which I have found examples and the Ranerox support team always suggesting RepoItemInfo.Exists(), so how do I use it?

One place I want to use it is accepting an illegal security certificate error that sometimes pops up (at a predictable point) on the site I am testing. So if this link (or page) is available click it else, move on.

Code: Select all

bool buttonExists = myRepo.MyForm.MyButtonInfo.Exists<Button>(out myButton);  
What is <button> and what does "MyButtonInfo" mean exactly? Also does this only work on forms/buttons? I would need it to either check the page or the link to click.

Thanks

Re: How to use RepoItemInfo.Exists()?

Posted: Wed Jul 06, 2011 12:46 pm
by Support Team
Hi,
Pixi6s wrote:What is <button>


Button is the adapter type which will be created, if the control exists (Exists<(Of <(T>)>) Method (adapter)).
Pixi6s wrote:and what does "MyButtonInfo" mean exactly?


Each item and each folder in a repository provides an additional object item declared with '<ObjectName>Info'. It is used to access item related attributes without accessing the UI element directly in order to prevent Ranorex from throwing exceptions. The info object is mainly used to check whether an item or a folder path is valid or not.
Please have a look at our code examples chapter to learn more about using the info objects:
Wait for UI Elements Using Repository
Pixi6s wrote:Also does this only work on forms/buttons? I would need it to either check the page or the link to click.
This works for all kinds of adapters. Please have a look at following blog post to learn how to handle pop up dialogs:
Handling dialog and pop up windows

Regards,
Tobias
Support Team

Re: How to use RepoItemInfo.Exists()?

Posted: Wed Jul 06, 2011 2:43 pm
by Pixi6s
Got it working thanks for the clarification.

Re: How to use RepoItemInfo.Exists()?

Posted: Fri Jul 15, 2011 8:52 pm
by Pixi6s
Can I limit how long it waits for? It seems like eternity....

Thanks

Re: How to use RepoItemInfo.Exists()?

Posted: Sat Jul 16, 2011 3:08 pm
by Support Team
Pixi6s wrote:Can I limit how long it waits for?
The Exists() method will try to find the element for the timeout specified for the corresponding repository item. See the "Effective Timeout" property of the repository item for the maximum time the method will wait:
http://www.ranorex.com/support/user-gui ... eouts.html

Regards,
Alex
Ranorex Team

Re: How to use RepoItemInfo.Exists()?

Posted: Tue Jul 19, 2011 1:48 pm
by Pixi6s
Thank you. It still seems to take longer than the 1000ms I have set it too, but it was set to 30s so BIG improvement :D

Re: How to use RepoItemInfo.Exists()?

Posted: Tue Jul 19, 2011 7:01 pm
by Pixi6s
What is effective timeout? I reduced the wait to 1ms and my effective timeout is still 1minute +.
Thanks

Re: How to use RepoItemInfo.Exists()?

Posted: Tue Jul 19, 2011 7:19 pm
by Support Team
Hi,

the effective timeout is the sum of all timeouts regarding the repository item.
So, if you have a repository item nested in a hierarchy of rooted folder allt the timeouts of the rooted folders, the timeout of the application folder and the timeout of the repository item will be added together.

Regards,
Tobias
Support Team