Method: Selenium::WebDriver::ActionBuilder#drag_and_drop_by

Defined in:
lib/selenium/webdriver/common/action_builder.rb

#drag_and_drop_by(source, right_by, down_by) ⇒ ActionBuilder

A convenience method that performs click-and-hold at the location of the source element, moves by a given offset, then releases the mouse.

Examples:

Drag and drop an element by offset


el = driver.find_element(id: "some_id1")
driver.action.drag_and_drop_by(el, 100, 100).perform

Parameters:

  • source (Selenium::WebDriver::Element)

    Element to emulate button down at.

  • right_by (Integer)

    horizontal move offset.

  • down_by (Integer)

    vertical move offset.

Returns:



342
343
344
345
346
347
348
# File 'lib/selenium/webdriver/common/action_builder.rb', line 342

def drag_and_drop_by(source, right_by, down_by)
  click_and_hold source
  move_by        right_by, down_by
  release

  self
end