Get list of items from one repository item

Ask general questions here.
mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Get list of items from one repository item

Post by mrt » Fri Jan 20, 2023 1:51 pm

Dear all,

assuming I have a repository item with Rxpath

Code: Select all

//button
which usually finds more than one button.
If I pass this RepoItem to a UserCode Method, how do I get not only one button, but the list of all buttons found out of it?

My workaround is currently to pass not the button, but a parent item and then use some parent.Find() method in the usercode, but this is uncomfortable as I cannot Spy or Highlight directly and have to manage RXpath in Usercode.

any ideas?

dhale
Posts: 84
Joined: Thu Feb 27, 2014 7:33 pm

Re: Get list of items from one repository item

Post by dhale » Sat Jan 21, 2023 4:51 am

Something like this

Code: Select all

IList<Button> allButtons = yourRepoItemInfo.CreateAdapters<Button>().ToList(); 
Where "yourRepoItemInfo" is the RepoItemInfo object of the repository item that gets you to all your buttons you want to see

mrt
Posts: 257
Joined: Mon Mar 16, 2020 11:31 am

Re: Get list of items from one repository item

Post by mrt » Sat Jan 21, 2023 8:12 am

ah yes, thanks.