How to verify calculated value for a non editable field?

How to validate this on katalon
calculating value
please help
the expected is to verify the total amount is correct when customer by 2 product

Should we brainstorm any calculation? :))

1 Like

You say, “non editable field”, but you have the text. You can get the text, which are Strings. After you get the text, you can pull out (or “split()”) the text that are digits/value and convert those Strings to real numbers (xxx as float) and do your math.
6.72 + 10.00 = Total Amount or 16.72
16.72 + 1.24 = Total or 18.06

String subTotalVal = WebUI.getText(findTestObject('...')
subTotalVal = subTotalVal.split(" ")[1]   // or maybe val1.split("SGD ")[1]
String totalShippingFee = WebUI.getText(findTestObject('...')
totalShippingFee = totalShippingFee.split(" ")[1]

totalAmt = (subTotalVal as float) + (totalShippingFee as float)
WebUI.verifyMatch(totalAmt.toString(), WebUI.getText(findTestObject('Total Amount')).split(" ")[1], false)

You may need to “store” the information for one item as you move to another so you can get the “Subtotal” and “Total Shipping Fee”, but it is not overly complicated. Can you show us any HTML or website?

1 Like

use excel for calculation and match value from there

@tebar

Is this image a screenshot of a part of a web page? If the web page is public to the Internet, that’s the best, please tell us the URL. If the URL is not public, please save the HTML source code of the page and share it here.

Without having the HTML source code visible, I can not make any practical suggestion.