Page 1 of 1

Search Item in a list and select

Posted: Fri Jul 24, 2020 9:40 am
by FrancisMoreau
Hi,
I'm a new user of Ranorex and I'm stuck on a multi-column list problem.
On a web page, I have to look for a value in the "Name" column and then click on an icon in the "Action" column
Image

I've searched the different tutorials and courses but I couldn't find anything..

Thank you for your help

Re: Search Item in a list and select

Posted: Mon Jul 27, 2020 6:13 pm
by Support Team
Hi Francis,

With a Ranorex Snapshot file, I can provide better example RxPaths, but in the meantime, I can use this test webpage (click "Load" to show the example table).

To achieve this, you want your RxPath to point to the "Name" cell, then back up to the row using /../ (parent), then down to the "Action" cell.

1. Point to "Name" cell:

Code: Select all

/dom[@domain='www.ranorex.com']//table[#'VIPs']//td[@innertext='Marie']
2. Navigate to parent row element using /../

Code: Select all

/dom[@domain='www.ranorex.com']//table[#'VIPs']//td[@innertext='Marie']/../
3. Navigate to child "Action" cell (5th column in this example). This is the final RxPath to use in the test. Changing "Marie" to another name will show the proper category in the row with this name.

Code: Select all

/dom[@domain='www.ranorex.com']//table[#'VIPs']//td[@innertext='Marie']/../td[5]
You should be able to apply this same method to your table. if you have any trouble with it, provide a Ranorex Snapshot file if this table and I will be happy to further assist.

Cheers,
Ned

Re: Search Item in a list and select

Posted: Thu Jul 30, 2020 11:06 am
by FrancisMoreau
Thank you for your help,

here is the snapshot
SelectOLTDetail.rxsnp
The structure of the table is a bit complicated I don't see how to go from the name to the action

Re: Search Item in a list and select

Posted: Thu Aug 06, 2020 8:37 am
by FrancisMoreau
Support Team wrote:
Mon Jul 27, 2020 6:13 pm
You should be able to apply this same method to your table. if you have any trouble with it, provide a Ranorex Snapshot file if this table and I will be happy to further assist.
Hi Support team,
Have you been able to examine my problem?
I'm still stuck.

Thank you for your help.

Re: Search Item in a list and select

Posted: Thu Aug 06, 2020 9:24 am
by odklizec
Hi,

The UI you are working with is somewhat complicated and there is not an easy way to achieve what you want. You must create at very least two xpaths and obtain ChildIndex of row, belonging to item you want to edit and then use this ChildIndex (representing row number) in second xpath (repo element), which finds the 'view' or 'remove' button (you need to create two repo elements, if you want to click both buttons) .

This xpath returns row, to which belongs the item name "78vzy1-gp-01" (of course, you should replace the hardcoded name with variable connected to data connector). Then using GetValue action, obtain the ChildIndex attribute of the row and store it in variable...
/dom[@domain='10.66.1.116:8080']//div[#'uxfwk-rm-coreEquipment-list-table']/?/?/div//table/tbody/tr/td[@class~'col-name']//div/span[@innertext='78vzy1-gp-01']/ancestor::tr
Now you need to apply the obtained ChildIndex value in below xpath, which returns either 'view' or 'remove' icon belonging to item you want to edit...
/dom[@domain='10.66.1.116:8080']//div[#'uxfwk-rm-coreEquipment-list-table']//div[@class~'col-last']/div[@class~'contents']/table/tbody/tr[@childindex=$obtainedChildIndexVal]//div[@class='ng-scope']//ul/li[@name='view']

/dom[@domain='10.66.1.116:8080']//div[#'uxfwk-rm-coreEquipment-list-table']//div[@class~'col-last']/div[@class~'contents']/table/tbody/tr[@childindex=$obtainedChildIndexVal]//div[@class='ng-scope']//ul/li[@name='remove']
Hope this helps?