2

I want to make pause command dynamic like define it first and multiple or divide it (in shortest form) in test as shown below:

enter image description here

2 Answers 2

6

Selenium docs mention that Javascript can be used in Selenium IDE in two ways. With script-parameters (storeEval etc) and with non-script parameters (direct javascript). The easier solution to your problem is using non-script parameters in your selenium-ide commands.

Simply replace ${delay}/2 with javascript{storedVars['delay']/2} and so on.. as shown in attached screenshot. You can also use echo command to verify if this solution is working as expected.

enter image description here

For more details, I recommend reading official selenium docs:

Selenium IDE official documentation on using javascript

0
4

You can make use of storeEval command in Selenium IDE. Using it you can add, divide, multiply any variable with desired value and then use it.

Command: storeEval Target: storedVars['delay']*2 Value: doubleDelay

<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
    <td>store</td>
    <td>5000</td>
    <td>delay</td>
</tr>
<tr>
    <td>storeEval</td>
    <td>storedVars['delay']*2</td>
    <td>doubleDelay</td>
</tr>
<tr>
    <td>echo</td>
    <td>${doubleDelay}</td>
    <td></td>
</tr>

</tbody></table>
</body>

reference for storeEval

2
  • Please dont post links but post an example which fits the question instead.
    – bish
    Commented Dec 18, 2015 at 5:29
  • I have edited my answer. Details added now.
    – AMfromNBS
    Commented Dec 18, 2015 at 5:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.