Assistance with validation in html table

Ask general questions here.
Posts: 42
Joined: Mon Jan 14, 2019 4:30 pm

Assistance with validation in html table

Post by cs97jjm3 » Tue Apr 21, 2020 8:56 am

Hello all, hope you are are well and staying safe.

need a bit of help i have following page with a html table and i need to verify amounts are correct... i am just looking at Company and Value

invoice validation.png
invoice validation.png (93.29 KiB) Viewed 339 times
my csv file is (sample)
Customer Invoice Value
1 £2,602.95
10 £48.00
11 £15.99
12 £56.01
13 £513.31
14 £88.00
15 £119.58
16 £30.00
17 £9.99
18 £35.00
19 £12.00
2 £172.00
20 £4.00
21 £14.00
3 £496.86
4 £60.00
5 £20.00
6 £69.99
7 £30.00
8 £9.99
9 £35.00
CLIENT100 £13.00
CLIENT101 £0.00
CLIENT102 £12.99
CLIENT103 £13.00
CLIENT104 £0.00
CLIENT105 £12.99
CLIENT106 £12.00
CLIENT107 £0.00
CLIENT108 £15.99
CLIENT109 £9.80

Attached is snapshot
invoice validation.rxsnp
(344.78 KiB) Downloaded 15 times

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

Re: Assistance with validation in html table

Post by odklizec » Tue Apr 21, 2020 10:18 am


And what exactly is your problem? As long as the list of companies is always in the same order, it should not be a problem to use the csv as data connector and simply enumerate all its rows and compare each row with appropriate TD tag in table? The only problem is, that there is currently no way to associate Company and Value header with appropriated TD cell, using an elegant one-do-it-all xpath. It's something I've requested a while ago, unfortunately, it got a very little attention from the community, therefore, it scored very low number or votes :) ... -html-cell

You have two options.
A) if you are sure, that the order of columns will remain the same over the time, ou can create an xpath with hardcoded index of TD belonging to Company and Value columns:
Company TD xpath:
Value TD xpath:
Now because you want to match "company" and "value" values, you can do something like this:
The above xpath returns "value" TD for company "10". Now you should variabilize the company:
So now if you connect the companyName variable with customer column in your csv, the test should cycle through the csv, and you can validate inner text of each returned TD element (by above xpath) with Invoice Value obtained from CSV file.

The problem of above solution is, that if the order of columns changes, you may need to manually update the TD indexes in above xpath. Hence it's better get the actual childindex of Customer and Value column via GetValue action, as described here: ... tml#p52064

B) A completely different approach could be using table snapshot and some code, as described here: ... einwebibri
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: 42
Joined: Mon Jan 14, 2019 4:30 pm

Re: Assistance with validation in html table

Post by cs97jjm3 » Tue Apr 21, 2020 1:43 pm

Thanks for reply very in-depth, but understandable, Thanks i went with your option A

big thanks:

I had already voted for that one :-)