How to get a series of numbers from objects of a WEB APP and add them , and verify if the total value corresponds with the adding of those numbers?

Tuesday, September 25, 2018
Avatar

I'm facing some difficulties in one case I have in my web app I'm currently working with, where there are multiple rows containing number values changing dynamically time after time, and there is TOTAL which is supposed to calculate all these numbers I mentioned above.
I want to create a script that will get the values of these numbers every time I run it, add between them and compare to the Total row.

Any help on this?

1 Replies
Saturday, September 29, 2018
Avatar
inflectra.jimx
re: jurial Tuesday, September 25, 2018

Hi Jurial,

To get the values of each row, you can LEARN the table object in Rapise and then use something like:

var rows = SeS("object").DoDOMQueryXPath('//tr');
for (var i = 0; i < rows.length; i++)
{
  var cell = rows[i].DoDOMQueryXPath('td[x]')[0];
  var val = Math.parseInt(cell.GetNodeText());
}

to get the value of each cell as a  number. Then use the same GetNodeText() on the total row, and compare using standard JavaScript functions.

You could also do it in RVL in a similar way.

Regards

Jim

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Tuesday, September 25, 2018
  • Last Reply: Saturday, September 29, 2018
  • Replies: 1
  • Views: 1677