Slicing the tables

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

Slicing the tables

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

Hello,
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.
table.rxsnp
(643.08 KiB) Downloaded 2 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4150
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

Hi,

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='6012-sbx.btbanking.com']//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:
/dom[@domain='6012-sbx.btbanking.com']//div[@id~'acctSummary-view']//section//table//tr/td[@childindex=$childIndex]
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
ChildIndex.png (46.99 KiB) Viewed 56 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)...
https://www.ranorex.com/help/latest/han ... 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

maamer
Posts: 16
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