如何在硒检测加载javascript文件是否通过AJAX加载? [英] How to detect in selenium whether loading of a javascript file is loaded via ajax?

查看:82
本文介绍了如何在硒检测加载javascript文件是否通过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屋!

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