3
我需要測試一些功能,我需要拖放一些UI元素。Watir - 拖放不工作
我試圖做到這一點http://www.html5rocks.com/en/tutorials/dnd/basics/此頁上:
browser.divs(:class => "column")[-2].drag_and_drop_on browser.divs(:class => "column")[-3]
在Chrome中,我看不出有什麼發生。 在firefox中,我看到鼠標按鈕已關閉,但沒有發生任何事情 - 元素沒有移動。 我在其他頁面也嘗試過,這似乎從來沒有工作。
我也試過這種解決方法(在多線程推薦),它不工作,要麼:
my_element = browser.divs(:class => "column")[-4]
target = browser.divs(:class => "column")[-3]
my_element.fire_event("onmousedown")
driver = browser.driver
driver.action.click_and_hold(my_element.wd).perform
driver.action.move_to(target.wd).perform
target.fire_event("onmouseup」)
我使用Ruby 1.9.3在Mac上。我也在Windows上試過ruby 2.1.5,結果是一樣的。
有沒有辦法用watir拖放?