Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

click / clickAndWait not working

Tags:

selenium-ide

A recorded test script includes a google search.

After clicking on "Google Search", the next action was to click on a link in the test results, however during playback this happens before the browser has loaded the results, so the solution seemed to be to add a delay after the search. I tried it two ways :

  • changing "click" to "clickAndWait" with a value of 1000. This works, badly. The value of 1000 does not change the default value of 30000ms, and the playback takes 30s to complete the step.

  • calling "setTimeout" before the click with a value of 1000. This has no effect on the timeout behavior of clickAndWait.

Here is the script :

<tr>
        <td>open</td>
        <td>/</td>
        <td></td>
</tr>
<tr>
        <td>type</td>
        <td>q</td>
        <td>test search</td>
</tr>
<tr>
        <td>setTimeout</td>
        <td></td>
        <td>1000</td>
</tr>
<tr>
        <td>clickAndWait</td>
        <td>btnG</td>
        <td>1000</td>
</tr>
<tr>
        <td>click</td>
        <td>link=CLEP Test Center Search</td>
        <td></td>
</tr>
<tr>
        <td>clickAndWait</td>
        <td>link=Home</td>
        <td></td>
</tr>

If anyone can advise, thanks very much.

like image 608
Literati Insolitus Avatar asked Sep 13 '10 18:09

Literati Insolitus


1 Answers

I would recommend another solution by adding a waitForElementPresent command before clicking the link.

  • open /
  • type q test search
  • click btnG
  • waitForElementPresent link=CLEP Test Center Search
  • click link=CLEP Test Center Search
  • waitForElementPresent link=Home
  • click link=Home

You can find a good explanation in http://www.infoq.com/articles/testing-ajax-selenium

like image 86
abochan Avatar answered Oct 20 '22 23:10

abochan