我是 Watir(以及 JavaScript)的新手,并且一直在关注相关的问题(以及答案)。我也经历了“萤火虫”的建议。在找出触发了哪些事件之后,我无法完全收集我们应该做什么。
在以下情况下,手动单击“概述”就足够了,但我无法编写代码来自动执行相同操作。
<div id="overview" class="dijitTreeIsRoot dijitTreeNode dijitTreeNodeUNCHECKED dijitUNCHECKED" role="presentation" style="background-position: 0px 0px;" widgetid="dijit__TreeNode_10">
<div class="dijitTreeRow" data-dojo-attach-event="onmouseenter:_onMouseEnter, onmouseleave:_onMouseLeave, onclick:_onClick, ondblclick:_onDblClick" role="presentation" data-dojo-attach-point="rowNode" title="" style="padding-left: 0px;">
<img class="dijitTreeExpando dijitTreeExpandoLeaf" role="presentation" data-dojo-attach-point="expandoNode" alt="" src="/hcsadmin/open/dojo/resources/blank.gif">
<span class="dijitExpandoText" role="presentation" data-dojo-attach-point="expandoNodeText">*</span>
<span class="dijitTreeContent" role="presentation" data-dojo-attach-point="contentNode">
<img class="dijitIcon dijitTreeIcon dijitLeaf" role="presentation" data-dojo-attach-point="iconNode" alt="" src="/hcsadmin/open/dojo/resources/blank.gif">
<span class="dijitTreeLabel" data-dojo-attach-event="onfocus:_onLabelFocus" aria-selected="false" tabindex="-1" role="treeitem" data-dojo-attach-point="labelNode">Overview</span>
</span>
</div>
<div class="dijitTreeContainer" style="display: none;" role="presentation" data-dojo-attach-point="containerNode"></div>
</div>
现在我可以使用以下方法刷新“概述”:
browser.div(:id, "overview").flash
它确实成功闪烁。但正如怀疑的那样,
browser.div(:id, "overview").click
不工作。
请为此提供解决方案(甚至更好的代码)。