Jailani24589
New Coder
Getting the values from the locator like below, if the locator have the negative values Total return NaN
Output
Line Amount-->90
Line Amount-->90
Line Amount-->−25
Line Amount-->NaN
JavaScript:
for (let i = 0; i < count-2; i++)
{
let estimateMiniCartAmount = (await _estimateTotalAmount.nth(i).innerText).replace('$','').replace('/mo', '').replace('.00','')
console.log(" Line Amount-->"+ estimateMiniCartAmount)
Total = parseFloat(Total) + parseFloat(Number(estimateMiniCartAmount))
console.log(" Line Amount-->"+ Total)
}
Output
Line Amount-->90
Line Amount-->90
Line Amount-->−25
Line Amount-->NaN