Module: Capybara::Selenium::Node::Html5Drag

Defined in:
lib/capybara/selenium/extensions/html5_drag.rb

Instance Method Summary collapse

Instance Method Details

#drag_to(element, html5: nil, delay: 0.05) ⇒ Object

Implement methods to emulate HTML5 drag and drop


7
8
9
10
11
12
13
14
15
16
# File 'lib/capybara/selenium/extensions/html5_drag.rb', line 7

def drag_to(element, html5: nil, delay: 0.05)
  driver.execute_script MOUSEDOWN_TRACKER
  scroll_if_needed { browser_action.click_and_hold(native).perform }
  html5 = !driver.evaluate_script(LEGACY_DRAG_CHECK, self) if html5.nil?
  if html5
    perform_html5_drag(element, delay)
  else
    perform_legacy_drag(element)
  end
end