Slicing the tables

Class library usage, coding and language questions.
Posts: 23
Joined: Fri Nov 30, 2018 6:03 pm

Slicing the tables

Post by maamer » Mon Dec 24, 2018 5:50 pm

iam new to ranorex. so i have a web table and i am trying to extract some data from the table. the columns in the table are draggable and re organized. so i want to extract the a column list from the table and read the contents in the column. for ex i have a column Account Name. so i want to read all the account numbers in the column or read few numbers by indexing. like acc_number[3,9]. is there any way to do that in ranorex or is it possible to write some code with "using system.collection.generic" library?. can anyone give me a syntax on how to write that??.

thank you.
(643.08 KiB) Downloaded 27 times

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

Re: Slicing the tables

Post by odklizec » Thu Dec 27, 2018 9:43 am


The solution of your problem is to get childindex attribute of the column header. You can do this by using GetValue action, pointed to the header cell of your choice (e.g. Account Name). The xpath for the column header should look like this:
/dom[@domain='']//div[@id~'acctSummary-view']//section//table/thead/tr/th[@title='Account Name']
You should store the obtained value to variable (e.g. childIndex), which will be used later. Then you should create another repo element, with the xpath pointing to cells with the same childindex (related to column header). The xpath should look like this:
For example, Account Name header, in your snapshot, has childindex 1. Which means that all cells under Account Name should have the same childindex. So the second xpath, if filled with correct ChildIndex, should return all cells belonging to header Account Name.
ChildIndex.png (46.99 KiB) Viewed 583 times
Then you can adapt code from this link, showing how to create a list of adapters from repo item (in your case second xpath)... ... oryelement
All you have to do is to replace Ranorex.Button with Ranorex.TdTag. Hope this helps?
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

Posts: 23
Joined: Fri Nov 30, 2018 6:03 pm

Re: Slicing the tables

Post by maamer » Thu Dec 27, 2018 6:14 pm

thank you sir, you are awesome