How to use RepoItemInfo.Exists()?

Ask general questions here.
Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

How to use RepoItemInfo.Exists()?

Post by Pixi6s » Tue Jul 05, 2011 11:43 pm

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

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

Re: How to use RepoItemInfo.Exists()?

Post by Support Team » Wed Jul 06, 2011 12:46 pm

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
.
Image

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: How to use RepoItemInfo.Exists()?

Post by Pixi6s » Wed Jul 06, 2011 2:43 pm

Got it working thanks for the clarification.

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: How to use RepoItemInfo.Exists()?

Post by Pixi6s » Fri Jul 15, 2011 8:52 pm

Can I limit how long it waits for? It seems like eternity....

Thanks

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

Re: How to use RepoItemInfo.Exists()?

Post by Support Team » Sat Jul 16, 2011 3:08 pm

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
.
Image

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: How to use RepoItemInfo.Exists()?

Post by Pixi6s » Tue Jul 19, 2011 1:48 pm

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

Pixi6s
Posts: 92
Joined: Tue Jun 28, 2011 8:57 pm

Re: How to use RepoItemInfo.Exists()?

Post by Pixi6s » Tue Jul 19, 2011 7:01 pm

What is effective timeout? I reduced the wait to 1ms and my effective timeout is still 1minute +.
Thanks

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

Re: How to use RepoItemInfo.Exists()?

Post by Support Team » Tue Jul 19, 2011 7:19 pm

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
.
Image