Hi,
scenario is including following steps:
- Take the cost value in one variable and do same for all cost present on the page
- Add all the variables.
- Compare with total cost displayed on page.
I am not able to add the variables.
Please help me.
Thanks,
Sristi Sharma.
You probably use WebUI.getText() to get numbers, so you must convert String variable to float/double.
String var1 = "17.5"
String var2 = "5.555"
Double number1 = Double.parseDouble(var1)
Double number2 = Double.parseDouble(var2)
println number1 + number2
Hi @Marek_Melocik,
Can I store the result of number1 + number2 in one variable?
Thank u for your quick reply.
Of course, but the variable must be Double type (and it could be casted afterwards if you want)
Double result = number1 + number2
// if you want to have String result
String resultAsString = result.toString()
Hi @Marek_Melocik,
I have tried it and it works,
Thank You.