How to get element with index???

Mar 18, 2010 at 12:12 PM

i have these lines:

string name= "something";

int index=1;

var element = item.GetElement(SearchCriteria.ByAutomationId(name).AndIndex(index))

and it returns me:

threw exception:  System.NullReferenceException: Object reference not set to an instance of an object..


while this works:

var element = item.GetElement(SearchCriteria.ByAutomationId(name))

but returns element witch is indexed as 0.


i'm creating WPF test with on c#, visual studio 2008 team system, win 7 64bit

Mar 18, 2010 at 12:29 PM

why do you think the index is "1"?




Mar 18, 2010 at 12:47 PM

sorry for double post: