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.
I would recommend another solution by adding a waitForElementPresent command before clicking the link.
You can find a good explanation in http://www.infoq.com/articles/testing-ajax-selenium