Fetching a Table Row value.

Best practices, code snippets for common functionality, examples, and guidelines.
theraviz
Posts: 72
Joined: Sun Apr 14, 2019 9:46 am

Fetching a Table Row value.

Post by theraviz » Sun Apr 19, 2020 10:06 am

I want to check the inner text of 3 TD's in a table and extract the value of the 4th TD.

But the problem is that the control properties which I want to verify in the 2nd TD and 3rd TDs are hyperlink and Image respectively. That means a hyperlink is residing in the 2nd TD and an Image is residing in the 3rd TD.

To be specific,

I want to compare the Innertext of TD 1 with the Innertext of the Hyperlink in TD2 with the Innertext of the Image in TD3 and if all are matching I have to get the InnerText of TD4.

Please help

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

Re: Fetching a Table Row value.

Post by odklizec » Sun Apr 19, 2020 3:12 pm

Hi,

Please post a Ranorex snapshot (NOT screenshot) of the table in question. Without, at very least, snapshot, there is not much anyone here can do or suggest. Thanks.
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

theraviz
Posts: 72
Joined: Sun Apr 14, 2019 9:46 am

Re: Fetching a Table Row value.

Post by theraviz » Mon Apr 20, 2020 7:01 am

odklizec wrote:
Sun Apr 19, 2020 3:12 pm
Hi,

Please post a Ranorex snapshot (NOT screenshot) of the table in question. Without, at very least, snapshot, there is not much anyone here can do or suggest. Thanks.
Hi,

Attaching the ranorex snap shot. There I have to extract the value from the last cell which is (1671.481) For that first I have to check

1) The first TD contains XXXX
2) Second TD contains YYYY (this is a hyper link)
3) Third TD contains ZZZZ (this is the inner text of the image)

If all the above three conditions are met then I have to extract the inner text of the 4th TD cell.
Last edited by theraviz on Mon Apr 20, 2020 11:56 am, edited 2 times in total.

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

Re: Fetching a Table Row value.

Post by odklizec » Mon Apr 20, 2020 7:36 am

Hi,

Well, here is an xpath, which should return content of 4th TD, in case all conditions are met:
/dom[@domain='aaa']//form[#'aspnetForm']/section/section//td/table//td[@innertext~'xxxx']/following-sibling::td/a[@innertext='yyyy']/../following-sibling::td/img[@src~'zzzz']/../following-sibling::td
Of course, you can replace each hardcoded value with variable and connect them all with data connector of your choice. Hope this helps?
Last edited by odklizec on Mon Apr 20, 2020 12:04 pm, edited 3 times in total.
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

theraviz
Posts: 72
Joined: Sun Apr 14, 2019 9:46 am

Re: Fetching a Table Row value.

Post by theraviz » Mon Apr 20, 2020 11:50 am

Thanks, It worked :)