开发者

click / clickAndWait not working

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.

  • 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜