我想使用FF Selenium IDE插件测试一个页面。
这个页面有如下的菜单结构...
<ul class="parent">
<li class="child"><span><a href="something.html">link text</a></span></li>
<li class="child"><span><a href="somethingelse.html">other text</a></span></li>
<ul>
var menu = $('ul.parent');
$("> li.child", menu).hover(function () {
$(this).find('> a').click(function () {
$(this).parent().addClass('active-trail');
return false;
});
}, function() {});
如果我使用Selenium点击其中一个链接,那么我期望处理程序被调用。但实际上没有,只是执行了点击操作(并且链接被跟踪),而不是返回false。
我已经尝试过(在阅读其他答案后)mouseUp和mouseDown。我还尝试使用fireEvent首先悬停在li上(以激活悬停事件),然后再使用另一个fireEvent单击anchor...但也不起作用。
因此,任何帮助都将不胜感激。仅演示如何使用Selenium触发jquery提供的单击处理程序可能就足以让我明白!
谢谢,Patrick.