Class: Capybara::Playwright::Node::DragTo
- Inherits:
-
Object
- Object
- Capybara::Playwright::Node::DragTo
- Defined in:
- lib/capybara/playwright/node.rb
Constant Summary collapse
- MODIFIERS =
{ alt: 'Alt', ctrl: 'Control', control: 'Control', meta: 'Meta', command: 'Meta', cmd: 'Meta', shift: 'Shift', }.freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(page, source, target, options) ⇒ DragTo
constructor
A new instance of DragTo.
Constructor Details
#initialize(page, source, target, options) ⇒ DragTo
Returns a new instance of DragTo.
864 865 866 867 868 869 |
# File 'lib/capybara/playwright/node.rb', line 864 def initialize(page, source, target, ) @page = page @source = source @target = target @options = end |
Instance Method Details
#execute ⇒ Object
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 |
# File 'lib/capybara/playwright/node.rb', line 871 def execute @source.scroll_into_view_if_needed # down position_from = center_of(@source) @page.mouse.move(*position_from) @page.mouse.down @target.scroll_into_view_if_needed # move and up sleep_delay position_to = center_of(@target) with_key_pressing(drop_modifiers) do @page.mouse.move(*position_to, steps: 6) sleep_delay @page.mouse.up end sleep_delay end |