Page 1 of 1

Assign Repository Itmes to List<T>

Posted: Tue Nov 08, 2016 10:19 am
by Utrehd
Hello

I would like to Create a List of buttons

Code: Select all

List<Ranorex.Button> buttons = new List<Ranorex.Button>();
and assign some repository items to it.

Code: Select all

buttons.Add(MyRepro.MainControl.SomeButton);

Now what happens is that before Ranorex adds this item into the list it will search on the screen for it. This i do not want, because sometimes the Items are not visible and it takes unnecessary time.

How can i Add an Repo item into a list without searching for it on the screen ?


Later i want to be able to use following code:

Code: Select all

foreach(var button in buttons)
{
	if(button.Visible == true)
	{
       	     Ranorex.Report.Success("Was found");
	}
}
Thanks
Sam

Re: Assign Repository Itmes to List<T>

Posted: Wed Nov 09, 2016 10:15 am
by odklizec
Hi Sam

I think your problem could be solved by using repo item "Info" object, as shown in this sample:
http://www.ranorex.com/support/user-gui ... html#c3574
The advantage of the "Info" object is that it access the element attributes without directly accessing the UI element. So it does not throw an exception if the element is not found and you can define the timeout how long the element should be searched for.