Division Operation in Katalon

I assume you can extract the “Premium” field from the UI. Otherwise, we will need to see the HTML of the field.
With the “Premium” field, you can remove the dollar sign, with either a format or replace, like:

import java.text.DecimalFormat

def strPremium = ...
def premiumValue = strPremium.replace('$', '')
"divide by two as either 'float' or 'double' if really big numbers"
def resultSet = (premiumValue as float)/2.0
def strOutput = new DecimalFormat("###,##0.00").format(resultSet);

def otherOutput = ...
WebUI.comment("Your values are: ${strOutput} and ${otherOutput}")
WebUI.verifyMatch(strOutput,  otherOutput, false) 

Edit: based on @kazurayam suggestion, I changed the double quotes to single quotes. see if that works for you. I ran the code on my machine with no issue (with assumed values).

1 Like