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.
729 730 731 732 733 734 |
# File 'lib/capybara/playwright/node.rb', line 729 def initialize(page, source, target, ) @page = page @source = source @target = target @options = end |
Instance Method Details
#execute ⇒ Object
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
# File 'lib/capybara/playwright/node.rb', line 736 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 |