I need to test some functionality where I need to drag and drop some UI elements.
I tried to do this on this page http://www.html5rocks.com/en/tutorials/dnd/basics/ :
browser.divs(:class => "column")[-2].drag_and_drop_on browser.divs(:class => "column")[-3]
In chrome, I don’t see anything happening. In firefox, I see the that the mouse button is down, but nothing else happens – the element didn't move. I tried in other pages as well and this never seemed to work.
I also tried this workaround (which is recommended in multiple threads) and it doesn’t work either:
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”)
I'm using ruby 1.9.3 on mac. I also tried ruby 2.1.5 on windows and the result was the same.
Is there a way to drag and drop with watir?