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

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
johnzer
Posts: 16
Joined: Thu Aug 18, 2016 9:27 pm

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

Post by johnzer » Tue Aug 30, 2016 2:44 pm

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.

johnzer
Posts: 16
Joined: Thu Aug 18, 2016 9:27 pm

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

Post by johnzer » Tue Aug 30, 2016 3:19 pm

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>