Compare row in DT

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Compare row in DT

Post by odklizec » Tue Mar 05, 2019 9:22 am

Hi,

As it looks, the content of the table you are working with, is only accessible with RAWTexts. That's bad, because none sample I provided is RAWText optimized. And I'm afraid, it's rather complicated to work with RAWtext-based tables. You can still access table elements via rows and columns. But for example column numbers of header cell does not match column numbers of data cells ;) For example, header cell "Kod" has column number 1. But cells belonging to column "Kod" have column number 0. So in my opinion, you will somehow have to adapt the "Advanced validation – entire table" sample code, to work with RAWTexts. Or you will have to write something completely new RawText-based.

If you want to validate just one row in table, you may be able to use xpath like this, to collect all RawTexts belonging to certain row (in this case row 1)...

Code: Select all

/form[@name='FrmMain']//table[@name='grd_Wspolnota']/rawtext[@row='1']
Then you can have a list of texts stored in txt/csv files and simply validate, if the list of texts obtained from row matches the list of texts stored in file. That would be probably the easiest solution. But if the number or texts change or the order of columns will be different, the code will fail.
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