Wildcard in path and user code

Ask general questions here.
bygones
Posts: 31
Joined: Fri Nov 27, 2015 11:32 am

Wildcard in path and user code

Post by bygones » Fri Oct 21, 2016 12:34 pm

Hi,

I have a xpath expression, that matches multiple elements. When adding this into a recording module via "user code", I can retrieve all of them in code via CreateAdapters.

How does this work with a code module ? There I can drag in the item from the repo, but I cannot cast it to IList, it seems to be seen as one.

Code: Select all

var repo = MySolution.Foo.FooRepo.Instance;
IList<DivTag> highlightedRows = repo.Foo.AList.highlightedRow;
which is wrong.

So, how can I get the list of matches in the code module ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Wildcard in path and user code

Post by odklizec » Fri Oct 21, 2016 12:46 pm

Hi,

Try this code:

Code: Select all

IList<DivTag> highlightedRows = repo.Foo.AList.highlightedRowInfo.CreateAdapters<DivTag>();
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration