如何让硒等待ajax响应? [英] How to get selenium to wait for ajax response?

查看:32
本文介绍了如何让硒等待ajax响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能让 selenium 等待日历小部件之类的东西加载?现在我只是在将测试用例导出到 junit 程序后执行 Thread.sleep(2500).

How can I get selenium to wait for something like a calendar widget to load? Right now I am just doing a Thread.sleep(2500) after exporting the testcase to a junit program.

推荐答案

我会使用

waitForElementPresent(locator)

这将等到元素出现在 DOM 中.

This will wait until the element is present in the DOM.

如果需要检查元素是否可见,最好使用

If you need to check the element is visible, you may be better using

waitForElementHeight(locator)

这篇关于如何让硒等待ajax响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆