TangibleDream
TangibleDream

Reputation: 611

Is there a way to pin point a drag_to?

I would like to drag an item to near the bottom of a container so that it is added to the bottom of a list.

Like so...

source = page.find('#foo')
target = page.find('#bar')
source.drag_to(target, :bottom_center)

or

source.drag_to(target, 50, 100)

Is there a way to accomplish such a thing?

Upvotes: 0

Views: 119

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49890

There is no Capybara built-in support for drag to a specific offset in an element, all element actions target the centers of elements. Since you're using selenium you can drop to the driver level and specify an offset, however it means you can't easily swap to another driver

page.driver.browser.action.
    click_and_hold(source.native).
    move_to(target.native, 50, 100).
    release.perform

Upvotes: 2

Related Questions