In my application, i have a value populated during runtime.
<span id="uxUnitPrice">182.18</span>
I want to extract this unit price and multiply against a fixed value for e.g. 15. Once i get the result on screen i want to fetch that and compare to see if calculation done by me matches what is displayed on screen. For e.g. result should be 182.18*15=2732.25 I tried below code but it is giving me NaN. Can someone please suggest how to perform a mathematical operation correctly using Selenium or protractor?
MeltValueCoin = element(by.css('[id="uxUnitPrice"]'));
expect(ValidateMeltValueCalculator()).tobe(2732.25);
function ValidateMeltValueCalculator(){
var units = 10;
var MeltValue = parseInt(MeltValueCoin.getText());
return units*MeltValue;}