how to repeat Selenium test script forever
I need to re-run my Selenium test script for unlimited number of times (infinite loop) - how I do that and what language should I us开发者_开发技巧e ?
thanks
Selenium supports lots of programming languages. See here for the full list:
http://seleniumhq.org/about/platforms.html#programming-languages
Just pick one of them and write an infinite loop that does what you need.
You could also use the Selenium Firefox plugin to do an initial recording of your script and then convert it to your language of choice.
Have a look at http://51elliot.blogspot.com/2008/02/selenium-ide-goto.html
A script you can add to selenium and offers looping and if/then
You can just write your task which you want to perform in loop. Put while loop to repeat your task number of times.
Here is the code to make a counter and create a while loop in Selenium script
<tr>
<td>getEval</td>
<td>index = 0;</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>index < 40;</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=page</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=correct</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=action</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index++;</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
TestMaker allows you to run Selenium scripts multiple times and as load tests and performance monitors. If you don't need more than 50 simulated users for load testing, then the community version is free.
http://www.pushtotest.com
I think it is useful to install FlowControl extension in Firefox. Of course you need to have Selenium IDE installed first. Restart firefox after the installation and then you can use in Selenium IDE:
label your_start_point
some selenium commands here (click, etc)
...
gotolabel your_start_point
You can find here the extension for Firefox.
精彩评论