简体   繁体   English

Selenium:如何在自定义jquery插件生成的选择框中查找要单击的元素

[英]Selenium: How to find which element to click in a custom jquery plugin generated select box

I am trying to automate a click on the multiple select dropdown in this example: http://davidwalsh.name/dw-content/jquery-chosen.php 在此示例中,我试图自动单击多选下拉列表http : //davidwalsh.name/dw-content/jquery-chosen.php

I am sending the click event to the li element with the class "active-result" (after clicking on the element that says "Select Frameworks..."). 我将点击事件发送到带有“活动结果”类的li元素(在单击显示为“ Select Frameworks ...”的元素之后)。

The issue is that the li element doesn't have the onclick handler, so the option is not added to the list. 问题是li元素没有onclick处理程序,因此该选项未添加到列表中。 How can I find the element that actually has the onclick handler in order to perform the action? 我如何找到实际上具有onclick处理程序的元素才能执行操作?

Found out by searching the code that the element didn't have an onclick handler, it actually was listening for a mouseup event. 通过搜索代码发现该元素没有onclick处理程序,它实际上是在监听mouseup事件。 So I modified my test to use: selenium.mouseup(). 因此,我将测试修改为使用:selenium.mouseup()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM