daniel
daniel

Reputation: 61

Parsing a number using Selenium IDE

I got in my site several amounts of money displayed like this: $5,000 I want to sum all of them and to check some variables. How can I parse and get the number 5000 and use it as a number (summing up, multiplying etc) using Selenium IDE?

Upvotes: 1

Views: 682

Answers (1)

alecxe
alecxe

Reputation: 473863

You can use storeEval and parse the string into the Number using javascript:

<tr>
    <td>storeEval</td>
    <td>Number('$5,000'.replace(/[^0-9\.]+/g,""));</td>
    <td>amount</td>
</tr>
<tr>
    <td>echo</td>
    <td>${amount}</td>
    <td></td>
</tr>

Upvotes: 1

Related Questions