Method: Capybara::Node::Element#drag_to

Defined in:
lib/capybara/node/element.rb

#drag_to(node, **options) ⇒ Capybara::Node::Element

Drag the element to the given other element.

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

Parameters:

  • node (Capybara::Node::Element)

    The element to drag to

  • options (Hash)

    Driver specific options for dragging. May not be supported by all drivers.

Options Hash (**options):

  • :delay (Numeric) — default: 0.05

    When using Chrome/Firefox with Selenium and HTML5 dragging this is the number of seconds between each stage of the drag.

  • :html5 (Boolean)

    When using Chrome/Firefox with Selenium enables to force the use of HTML5 (true) or legacy (false) dragging. If not specified the driver will attempt to detect the correct method to use.

  • :drop_modifiers (Array<Symbol>, Symbol)

    Modifier keys which should be held while the dragged element is dropped.

Returns:



418
419
420
421
# File 'lib/capybara/node/element.rb', line 418

def drag_to(node, **options)
  synchronize { base.drag_to(node.base, **options) }
  self
end