如何在硒检测加载javascript文件是否通过AJAX加载? [英] How to detect in selenium whether loading of a javascript file is loaded via ajax?
问题描述
我的主页加载通过AJAX另一页。其中有JavaScript文件。如何检测硒的AJAX页面加载是否完成?我可以检查装载元素。但也有联系而不能点击,直到该JavaScript文件中的内页是完全加载。我如何确保这些链接不能点击?
My main page loading another page via ajax. Which has javascript file. How do i detect whether that ajax page loading is completed in selenium ? I can check for element loaded. But there are links which are not clickable till that javascript file in inner page is loaded completely. How do i make sure those links are not clickable ?
由于否则单击事件失败。虽然元素是present但它无法点击。 它sumple锚状链接
Because otherwise click event is failing. Though element is present But its not clickable. Its sumple anchor like Link
推荐答案
有没有内在机制,硒检测Ajax请求。
硒2有这样的路线图。
硒元素添加 waitForcondition
。
There is no inbuilt mechanism in selenium to detect ajax requests.
Selenium 2 has this in road map.
Add waitForcondition
in selenium.
selenium.browserbot.getUserWindow().$.active== 0
请注意:这工作,如果你的网页使用jQuery的。对于其他frameworks..there不同的方式替换$。主动用别的东西。
NOTE: This works if your page uses jquery. For other frameworks..there are different ways replace $.active with something else.
这篇关于如何在硒检测加载javascript文件是否通过AJAX加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!