I want to make pause command dynamic like define it first and multiple or divide it (in shortest form) in test as shown below:
2 Answers
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.
For more details, I recommend reading official selenium docs:
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>
-
Please dont post links but post an example which fits the question instead.– bishCommented Dec 18, 2015 at 5:29
-