基本上,我想要做的是點擊一個按鈕,變得可見時,懸停其他元素(其父母)。如何模仿鼠標懸停與水豚
我試圖在隱藏按鈕的父級上使用trigger.('mouseover')
,但這似乎不起作用。
下面是從規範的代碼片段:
# label[for ... ] -> the parent element
page.execute_script("$('label[for=\"department_#{department.id}\"]').trigger(\"mouseover\")")
# le hidden button
find(".actions").click
# some <li> on a list that drops down when clicking the hidden button
click_on("Edit department")
和錯誤...
Failure/Error: click_on("Edit department")
Selenium::WebDriver::Error::ElementNotVisibleError:
Element is not currently visible and so may not be interacted with
我想知道我怎麼可以讓.actions
按鈕在網頁上顯示,在以後點擊它。
任何幫助將不勝感激。
爲什麼這不是最好的答案? – manu 2014-07-04 11:25:49
OP(原始海報)一年前得到了答案,並接受了它。時間已經過去了,現在這個答案更好了,但是OP需要選擇它才能將它移到頂端。 – 2014-07-10 13:53:35
這不適用於'xvfb-run -a' :( – brauliobo 2015-08-30 23:59:37