Reputation: 10215
Right now I'm using the selenium driver with Capybara, but I'd like to switch to using Poltergeist. A lot of the interface I'm testing, though, involves dragging and dropping elements in particular locations on the page. I've written the following method for dragging and dropping, which works in selenium:
def drag_drop(page, draggable, droppable, xoffset, yoffset)
driver = page.driver.browser
driver.mouse.move_to(draggable.native, draggable.native.size.height / 2, draggable.native.size.width / 2)
driver.mouse.down
driver.mouse.move_to(droppable.native, droppable.native.size.height / 2 + yoffset, droppable.native.size.width / 2 + xoffset)
driver.mouse.up
end
How would I go about writing something like this in poltergeist?
Upvotes: 8
Views: 2042
Reputation: 1051
I don't know if it's exactly what you're looking for, but Capybara has an API for dragging which Poltergeist supports.
Upvotes: 3