1

I am first time using Selenium for automating some developer tests.

I have some intermediate steps, which needs to run based on certain condition like a while loop

<tr>
    <td>clickAndWait</td>
    <td>//a[contains(text(),'active listings')]</td>
    <td></td>
</tr>

//while(delist elementPresent) -----------------------------
<tr>
    <td>verifyElementPresent</td>
    <td>name=delist</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=listing_check_all</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=delist</td>
    <td></td>
</tr>
<tr>
<td>verifyElementPresent</td>    ------------repeated step
    <td>name=delist</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>id=listing_check_all</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>name=delist</td>
    <td></td>
</tr>
//end while (i.e. delist element no longer present) ---------------
<tr>
    <td>verifyText</td>
    <td></td>
    <td>No active listings found</td>
</tr>

One more question, can I automate this process from command line? I can write a script (.bat/.sh) to automate the test case run.

Note: Please do understand that I am using selenium for the first time, just to automate few dev tests.

RaceBase
  • 18,428
  • 47
  • 141
  • 202

2 Answers2

1

Selenium IDE doesn't give looping functionality, you will need to install an add on like this: https://github.com/darrenderidder/sideflow

jmccure
  • 1,180
  • 7
  • 16
  • I am ready to install. Thing is, can you give me sample or how to write modify my test case as i explained in original post – RaceBase Feb 21 '14 at 13:51
0

There are plugins you can add to Selenium IDE that will help you accomplish loops. You can look at a list of plugins here.

I believe the plugin you're look to achieve the while loop with is called SelBlocks. I believe the Flow Control plugin does this as well. I've used this in the past with great success. A few things to note though:

(1) Don't expect documentation for these commands to show up in the Reference tab. You'll have to read the Selblocks Reference page listed with the plugin for examples on how to implement its commands.

(2) If you intend to export your 'Selenese' code over to Java, C#, Python, or any other language, these commands won't export over. You'll have to hard code anything you created that's directly associated with any plugin command('s) you used (i.e. while, for, if, etc...) in that programming language's native code.

Hope this helps someone out.

rwbyrd
  • 416
  • 5
  • 24