I am able to execute the following code to move the slider handle, but the events triggered in the browser are not taking place.
page.execute_script(%Q($(\
resynchronize has been removed from Capybara 2.0 so user853088's answer for Selenium would now look like this:
module CapybaraSeleniumExtension
def drag_by(right_by, down_by)
driver.browser.action.drag_and_drop_by(native, right_by, down_by).perform
end
end
I extended capybara dragging before.
It can move elements by a given offset.
You could try
module CapybaraExtension
def drag_by(right_by, down_by)
base.drag_by(right_by, down_by)
end
end
module CapybaraSeleniumExtension
def drag_by(right_by, down_by)
resynchronize { driver.browser.action.drag_and_drop_by(native, right_by, down_by).perform }
end
end
::Capybara::Selenium::Node.send :include, CapybaraSeleniumExtension
::Capybara::Node::Element.send :include, CapybaraExtension
And then
page.find('#slider_handicap').drag_by(30, 0)
But it may not suit the slider's scale.
The original are
There are a few words of caution.