onclick 事件不适用于 firewatir 中的编辑框
我面临 onclick 事件触发事件方法的问题,它在 Firefox(3.5.6) 中不起作用,而在 IE 中则正常,
当我在 Firefox 中运行脚本时,它不执行 onlcick 事件操作,只需执行该步骤而不会给出任何错误 虽然相同的代码当我在 IE 上运行时它工作正常。这是 firewatir bug 吗? onclick 事件不适用于 firewatir 中的编辑框
$ie.form(:id ,"mainForm").text_field(:id, "ItemTagSearchWidgetGameDate").fire_event("onclick")
HTML 看起来像这样
<input type="text" readonly="readonly" value="click here to pick a game date" class="gameDate" onclick="bam.dateSelector.prepareAndShow(this)" style="width: 235px;" id="ItemTagSearchWidgetGameDate">
我正在使用 firewatir (1.6.5)
这是 firewatir 的错误吗?
I am facing problem for onclick event fire event method it is not working in firefox(3.5.6) while fine in IE
when i run the script in Firefox it does not perform the onlcick event opeartion, just execute the step without giving any error
While same code when i run on IE it is working fine.Is it firewatir bug? onclick event does not work for editbox in firewatir
$ie.form(:id ,"mainForm").text_field(:id, "ItemTagSearchWidgetGameDate").fire_event("onclick")
The HTML looks like this
<input type="text" readonly="readonly" value="click here to pick a game date" class="gameDate" onclick="bam.dateSelector.prepareAndShow(this)" style="width: 235px;" id="ItemTagSearchWidgetGameDate">
I am using firewatir (1.6.5)
Is this bug with firewatir ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两个建议
1)尝试只触发 .click
我通常只会尝试 fire_event 方法,其中使用简单的 .click 失败,或者正在寻找不同的更具体的事件。
另外你会注意到我删除了 .form 的东西,因为文本输入字段有一个唯一的 ID,不需要指定外部容器。您只需要对缺乏唯一标识的简单方法的元素执行此类操作,并且您被迫通过它们在某个更容易识别的容器元素内的位置来找到它们。
2) 尝试使用 Watir-Webdriver 而不是 Firewatir。您可以获得跨浏览器功能,并且它支持较新版本的 Firefox,而 Firewatir 则不能,因为在任何较新的版本(7、6、5 等)中缺乏任何 JSSH 支持
Two suggestions
1) try just firing .click at it
I would generally only try the fire_event method where using simple .click fails, or a different more specific event is being looked for.
Also you will note I dropped the .form stuff, because the text input field has a unique ID, there is no need to specify an outer container. You only need to do that sort of thing with elements which lack an easy means of being uniquely identified and you are forced to find them via their position inside some container element that is easier to identify.
2) Try using Watir-Webdriver instead of Firewatir. You get cross browser capability, and it supports newer versions of firefox, where Firewatir cannot due to the lack of any JSSH support in any of the more recent versions (7, 6, 5, etc)