watir 显示新下拉菜单的问题
手动单击选项卡(锚标记),其显示带有 watir 元素的下拉菜单(无序列表),但下拉菜单未显示
HTML
<ul>
<li id="NetworkAnalysisTabPanel__ext-comp-1038" class=" x-tab-strip-menuable x-tab-strip-active ">
<a class="x-tab-strip-close" onclick="return false;"></a>
<a class="x-tab-strip-menu" onclick="return false;"></a>
<a></a>
<a class="x-tab-right" onclick="return false;" href=""></a>
</li>
</ul>
尝试使用以下代码行单击选项卡
$ff.div(:id,"NetworkAnalysisTabPanel").div(:index,1).div(:index,1).ul(:index,1).li(:index,1).link(:index,2).fire_event("onClick")
我正在使用 watir 1.6.6 版本
manually clicking on tab(anchor tag) its displaying drop down menu(unordered list) with watir element is locating but drop down menu is not displaying
HTML
<ul>
<li id="NetworkAnalysisTabPanel__ext-comp-1038" class=" x-tab-strip-menuable x-tab-strip-active ">
<a class="x-tab-strip-close" onclick="return false;"></a>
<a class="x-tab-strip-menu" onclick="return false;"></a>
<a></a>
<a class="x-tab-right" onclick="return false;" href=""></a>
</li>
</ul>
Tried the following line of code to click on the tab
$ff.div(:id,"NetworkAnalysisTabPanel").div(:index,1).div(:index,1).ul(:index,1).li(:index,1).link(:index,2).fire_event("onClick")
I am using watir 1.6.6 version
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,由于您提供的 HTML 示例不包含您在尝试的命令中使用的元素,因此很难知道哪里可能出了问题。其次,由于您提供的代码确实有一个带有唯一 ID 的 div,为什么不从那里开始而不是从外部容器开始。
我认为问题是您正在使用
但是代码正在监视名为“onclick”(全部小写)的事件
尝试使用
or 如果您还没有,也许只是
看看这是否适合您
另外,我会认真对待建议您升级到更新版本的 Watir.. 1.6.6 已经落后于时代了。
更新:html 代码开始对我来说非常熟悉,如果这是与您迄今为止发布的其他两个问题相同的基本控制,那么尝试针对调用菜单的元素触发“onmousedown”事件并查看如果可行的话
Firstly since your HTML sample that you provided does not include the element you are using in the command you attmepted, it's hard to know where that might be going wrong. Secondly since the code you provided does have a div with a unique ID present, why not start there instead of with an outer container.
I think the problem is that you are using
However the code is monitoring for an event named "onclick" (all lower case)
Try using
or if you have not already, perhaps just
and see if that works for you
Also, I'd seriously recommend you upgrade to a more current version of Watir.. 1.6.6 is pretty behind the times.
Update: that html code is starting to look very familiar to me, if this is the same basic control from the other two questions you've posted so far, then try firing the 'onmousedown' event against the element that invokes the menu and see if that works