Module: OnlyofficeWebdriverWrapper::WebdriverMoveCursorMethods
- Included in:
- WebDriver
- Defined in:
- lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb
Overview
Methods for webdriver to move cursor
Instance Method Summary collapse
-
#drag_and_drop(xpath, x1, y1, x2, y2, mouse_release: true) ⇒ Object
Perform drag’n’drop action in one element (for example on big canvas area) for drag’n’drop one whole element use ‘drag_and_drop_by’ ==== Attributes.
-
#drag_and_drop_by(source, right_by, down_by = 0) ⇒ Object
Perform drag’n’drop one whole element for drag’n’drop inside one element (f.e. canvas) use drag_and_drop ==== Attributes.
-
#mouse_over(xpath_name, x_coordinate = 0, y_coordinate = 0) ⇒ nil
Move mouse over element.
-
#move_to_element_by_locator(xpath_name) ⇒ nil
Move cursor to element.
Instance Method Details
#drag_and_drop(xpath, x1, y1, x2, y2, mouse_release: true) ⇒ Object
Perform drag’n’drop action in one element (for example on big canvas area) for drag’n’drop one whole element use ‘drag_and_drop_by’
Attributes
-
xpath
- xpath of element on which drag and drop performed -
x1
- x coordinate on element to start drag’n’drop -
y1
- y coordinate on element to start drag’n’drop -
x2
- shift vector x coordinate -
y2
- shift vector y coordinate -
mouse_release
- release mouse after move
16 17 18 19 20 21 22 23 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb', line 16 def drag_and_drop(xpath, x1, y1, x2, y2, mouse_release: true) move_action = move_to_driver_action(xpath, x1, y1) .click_and_hold .move_by(x2, y2) move_action = move_action.release if mouse_release move_action.perform end |
#drag_and_drop_by(source, right_by, down_by = 0) ⇒ Object
Perform drag’n’drop one whole element for drag’n’drop inside one element (f.e. canvas) use drag_and_drop
Attributes
-
source
- xpath of element on which drag and drop performed -
right_by
- shift vector x coordinate -
down_by
- shift vector y coordinate
32 33 34 35 36 37 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb', line 32 def drag_and_drop_by(source, right_by, down_by = 0) shift_to_zero = move_to_shift_to_top_left(source) @driver.action.drag_and_drop_by(get_element(source), right_by - shift_to_zero.x, down_by - shift_to_zero.y).perform end |
#mouse_over(xpath_name, x_coordinate = 0, y_coordinate = 0) ⇒ nil
Move mouse over element
53 54 55 56 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb', line 53 def mouse_over(xpath_name, x_coordinate = 0, y_coordinate = 0) wait_until_element_present(xpath_name) move_to_driver_action(xpath_name, x_coordinate, y_coordinate).perform end |
#move_to_element_by_locator(xpath_name) ⇒ nil
Move cursor to element
42 43 44 45 46 |
# File 'lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb', line 42 def move_to_element_by_locator(xpath_name) element = get_element(xpath_name) @driver.action.move_to(element).perform OnlyofficeLoggerHelper.log("Moved mouse to element: #{xpath_name}") end |