Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium IDE testing all links

I'm trying to use Selenium IDE to test a web app. On one page, there are several links which trigger modal windows. I'd like to test ALL the links on the page to ensure that ALL cause modals to pop up.

Each link has a class "modal" so I thought I could just change the target value in IDE css=a.modal but that finds only the first link.

I've found a few solutions but they use Selenium RC with Java/Python and those can't be directly translated to the IDE.

I understand the IDE is not as powerful but I'm setting this up for a non-programmer to use and up till now, it's been really simple for them.

like image 941
hasan Avatar asked Apr 13 '12 08:04

hasan


1 Answers

i had to read up a lot and i want to thank @ohaal and @aleh for their inputs. i used their suggested links as well as some more external reading to reach the solution like so:

<tr>
<td>open</td>
<td>/logout</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Forum</td>
<td></td>
</tr>
<tr>
<td>storeXpathCount</td>
<td>//p[3]/span/a[contains(@class, 'modal')]</td>
<td>users</td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>i</td>
</tr>
<tr>
<td>while</td>
<td>storedVars.i&lt;=storedVars.users</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//descendant::a[contains(@class, 'modal')][${i}]</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>css=h2</td>
<td>You are not logged in</td>
</tr>
<tr>
<td>click</td>
<td>css=#cross_button &gt; a &gt; img</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars.i++}</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>

i'm not selecting any one answer as all of them contributed to the final solution.

like image 198
hasan Avatar answered Nov 11 '22 06:11

hasan