TestProject Forum

Count and add the value of rows in the web table

Hi,

I am trying to automate the web table using smart recorder, so the challenge which i am facing with test project is - ‘while i am trying to count and add the values in the web table, i am not able to find the optimal solution for that’ please help me out with that.

In this screenshot, so i want to calculate the highlighted value and it is dynamic.

Hi @fatema ,
Are the number of rows and columns dynamic as well?
If not you can simply use the action “Get numbers only” from the cells and sum it into a parameter.

If they are dynamic it’s a bit more tricky, you can use this XPath to find the cell (Litchi (KG)) by text, and find the cells from it:

//td[. = 'Laughing Bacchus Winecellars']/parent::tr/following-sibling::tr/td[1]

First, we find the wanted cell or a cell with a consistent value for example “Litchi (KG)” using the following XPath:
/parent::tr/following-sibling::tr/td[1]

Then we want to find the parent row, we can use this /parent:: to find it
//td[. = 'Laughing Bacchus Winecellars']/parent::tr

After that, we can find the next row by using the /following-sibling::tr using this XPath:
//td[. = 'Laughing Bacchus Winecellars']/parent::tr/following-sibling::tr

Finally we can choose the cells we want by add /td[number] with this xpath:
//td[. = 'Laughing Bacchus Winecellars']/parent::tr/following-sibling::tr/td[1]

Let me know if you have any questions, feel free to tag me (@Amit.Lacher )

@Amit.Lacher
can we please connect on a zoom call?

Please contact us via our live chat which can be found here:
With your exact issue.

image