How to handle a particular row and column in a Dynamic Web Table

Ask general questions here.
rahulranjan
Posts: 1
Joined: Tue Oct 30, 2018 6:04 am

How to handle a particular row and column in a Dynamic Web Table

Post by rahulranjan » Tue Oct 30, 2018 6:14 am

In my test scenario, we have a Dynamic Web table whose number of rows increases whenever a new row is added by any users.
and i want to select the last row (./tr) from the table and then enter some text in the text field of the 2nd column (./td[2]) and 5th column (./td[5]) using Ranorex (version 6.1.0) and C#.

Any suggestion is appreciated :)
Thanks in advance.

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

Re: How to handle a particular row and column in a Dynamic Web Table

Post by odklizec » Tue Oct 30, 2018 12:51 pm

Hi,

It would be very useful if you post a Ranorex snapshot (NOT screenshot) of the table in question. Without snapshot, it's hard to suggest something reliable.
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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: How to handle a particular row and column in a Dynamic Web Table

Post by krstcs » Tue Oct 30, 2018 2:26 pm

As Pavel said, it would be helpful if you posted a Ranorex Snapshot of the table.

In addition, this is actually one of the times that you probably SHOULD use indexes.

For example, to get the last row, you would use: "./tr[-1]". You have already demonstrated that you understand how to get the 2nd and 5th, etc.

You can parameterize the index as well, so you can pass it in at runtime from a datasource or a different variable, like: "./tr[$myIndex]".


Edit to add: Note that XPath (and therefore RanoreXPath) indexes are 1-based, NOT 0-based like .NET indexes.
Shortcuts usually aren't...