Page 1 of 1

How to get list of UI elements and check their attributes?

Posted: Tue Aug 30, 2016 2:44 pm
by johnzer
Hello all,

I'm trying to figure out how to verify the attributes of a list of elements that each have (somewhat) matching RanoreXPaths.

I've tried creating an Adapter, and using that to fetch all matching elements. This works, and the resulting IList has the correct number of elements. When I try using GetAttributeValue() on the elements, however, I get an "Object reference not assigned to instance of object" exception.

For reference, my code is below:

Code: Select all

Adapter NativeWindowAdapter = repo.<MYSTUFF>.SelfInfo.CreateAdapter<NativeWindow>(false);
	            
IList<NativeWindow> OpenWindowList = NativeWindowAdapter.Find<NativeWindow>
(<STUFF>);

OpenWindowList[1].GetAttributeValue<String>("Instance");
Maybe I'm using the IList incorrectly? Any guidance would be appreciated.

Re: How to get list of UI elements and check their attributes?

Posted: Tue Aug 30, 2016 3:19 pm
by johnzer
Found the answer here:

http://www.ranorex.com/forum/identify-c ... t9722.html

Turns out I was misunderstanding what I was actually getting the IList. To access the attribute value, it just needs to be accessed as an attribute of the object, i.e.

Code: Select all

NativeWindow.<Attribute>