查看了很多問題和論壇,但我無法弄清楚。與Watir相當新鮮。懸停並點擊動態內容
否則在網頁上,其中用戶可以創建組測試(該溶液是在kendoui框架內構建)
創建組。
browser.button(:ID => 「add_group」)點擊
browser.text_field。(:ID => 「GROUP_NAME」)集( 「刪除」)
browser.button(:點擊
組創建,然後我想刪除組。如果用戶將鼠標懸停在新組上,則會在組容器的右側出現thrashcan符號,然後單擊該組將被刪除。
代碼:事情
<div id="left_pane" class="side_panel k-pane k-scrollable" style="position: absolute; top: 0px; width: 220px; height: 724px; left: 0px;">
<ul id="toolbox_panel" class="k-widget k-reset k-header k-panelbar" data-role="panelbar">
<li class="k-item k-state-default k-first">
<li id="group_ungrouped" class="k-item k-state-default" data-role="droptarget">
<li id="group_delete" class="k-item k-state-default k-last" data-role="droptarget">
<span class="k-link k-header k-state-hover">delete</span>
<!--snipp below is only visible on hover of delete element-->
delete
<span class="minicon remove_pod"></span>
</li>
夫婦我已經嘗試過的Watir:
browser.div(:身份證, 'left_pane')UL(:身份證, 'toolbox_panel')。李(:ID, 'group_delete')。跨距(:類, 'minicon remove_pod')。fire_event 「點擊」
給出以下:
C:/Ruby193/lib/ruby/gems/1.9 0.1 /寶石/的Watir -webdriver-0.6.1/LIB /的Watir-的webdriver /元件/ element.rb:36 5:
assert_exists': unable to locate element, using {:class=>"minicon remove_pod", :tag_name=>"spa n"} (Watir::Exception::UnknownObjectException) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/elements/ element.rb:247:in
fire_event ' 從C:/bin/scripts/ruby/sm_groups.rb:34:在`'
其他檢查:
browser.div(:身份證, 'left_pane')UL(:身份證, 'toolbox_panel')裏。(:身份證, 'group_delete')。跨距(:類/ K-狀態懸停/)。span(:class,'minicon remove_pod')。fire_event「onclick」
browser.div(:id,'left_pane')。ul(:id,'toolbox_panel')。li ('class','k-link k-header k-state-hover')。span(:class,'minicon remove_pod')。點擊
我對如何懸停「group_delete」有點遺憾,然後在懸停時找到刪除/ minicon remove_pod並單擊它以刪除創建的內容。
如果需要更多信息,請讓我知道。
問候
錯誤消息說「無法找到元素」,所以一定要正確識別的元素。 – 2012-08-03 11:52:11