Answered

Identify each row data inside a table on a webpage

I need help with identifying the cell inside a table. The table contains multiple rows web page, I have to check if the displayed values are correct. I want to loop through the number of rows and get the value from a cell. I am trying to give a different target label for each row and end up getting XPath could not be generated message. 

0
7 comments
Avatar
Joseph Hamdan

Hi Varu,

Your XPath should work across different rows using a specific number and this number can be replaced with the loop variable.

For example, this page displays a table where the XPath below works by using different numbers. The number next to (tr) controls which row to go through and the number next to (td) controls which cell to go to.

//table/descendant::tr[5]/td[3]

If Loop command is used, you can replace the row number with the variable to move between different rows, your XPath will look like this:

//table/descendant::tr[@loop]/td[3]

Please let me know if this make sense. I can also inspect any test case and fix it if you like.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Varu Vemula

Please help how to use this inside the test step.

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Varu,

You can use a similar XPath to the one mentioned above with Get_Web_Value command. This command will allow you to get the value from your web page and store it into a variable for your comparison purposes. Here are some articles on these commands that you can use:

https://subject7.atlassian.net/wiki/spaces/SD/pages/874873024/GET+WEB+VALUE+Command

https://subject7.atlassian.net/wiki/spaces/SD/pages/874840338/LOOP+Command

https://subject7.atlassian.net/wiki/spaces/SD/pages/874774610/COMPARE+Command

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Varu,

Would it be possible to provide more info on this scenario you are working on? I can help you with building it.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Prasanna Lakshmi

Hi Joseph,

I am also in the same situation identifying rows and cells using xpath.  Here my situation is, For Period Q1 , I have to verify the payment ( $6,913.51), and this testcase should pass even if the payment numbers are changed. Please help me with this ?

0
Comment actions Permalink
Avatar
Prasanna Lakshmi

Hi Joseph,

I am also in the same situation identifying rows and cells using xpath.  Here my situation is, For Period Q1 , I have to verify the payment ( $6,913.51), and this testcase should pass even if the payment numbers are changed. Please help me with this ?

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Prasanna,

Would you please submit a ticket using the appropriate form in the link below? Please include all information as we do not have access to on-prem environments so we need as much information as possible to assist you.

https://subject7.zendesk.com/hc/en-us/requests/new

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.