Pages

Search This Blog

Monday, May 17, 2010

How to use GOtoIf and while in selenium IDE

Selenium IDE has some programing capacity upto some extend. There we can use If conditions and loop statements.

How to use GOtoIf and while

<tr>
<td>store</td>
<td>1</td>
<td>looptimes</td>
</tr>

<tr>
<td>while</td>
<td>storedVars.looptimes < 11</td>
<td></td>
</tr>

<tr>
<td>store</td>
<td>javascript{storedVars.looptimes++;}</td>
<td></td>
</tr>

<tr>
<td>gotoIf</td>
<td>javascript{(storedVars.looptimes==5);}</td>
<td>lbltest</td>
</tr>

<tr>
<td>open</td>
<td>http://www.yahoo.com</td>
<td></td>
</tr>

<tr>
<td>echo</td>
<td>${looptimes}</td>
<td></td>
</tr>

<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>

<tr>
<td>label</td>
<td>lbltest</td>
<td></td>
</tr>

If your selenium IDE does not support while or if you don't have while js in your extension Please download below js and add in your extension.


Click here to download while.js

8 comments:

  1. Gracias.

    It should be nice to initialize that var 'store' to 0. Nice code dude.

    Thank You and greetings from Peru.

    ReplyDelete
  2. FYI - Here is an extension that adds full-fledged looping, conditional execution, and callable functions to Selenium IDE: http://wiki.openqa.org/display/SEL/SelBlocks

    ReplyDelete
  3. By the way, I had tried the same with while.js also.same results.

    ReplyDelete
  4. Here's an easy solution :


    http://ia2tech.blogspot.com/2013/05/selenium-ide-flow-control-and-looping.html

    ReplyDelete
  5. Hello,
    How "while.js" installed ?, or where to configure to work ?.
    thank you very much.

    ReplyDelete
  6. Great content, but extremely annoyed by all the ads. Maybe tone it down a bit.

    ReplyDelete
  7. The benefits of Selenium for Test Automation are immense. Amongst the many benefits, Selenium is an Open-Source tool and is easy to get started with for functional testing of web applications. Importantly, it enables record and playback for testing web applications and can run multiple scripts across various browsers. Selenium Training in Chennai

    ReplyDelete