onlyoffice_webdriver_wrapper 1.8.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/onlyoffice_webdriver_wrapper/version.rb +1 -1
- data/lib/onlyoffice_webdriver_wrapper/webdriver/click_methods.rb +5 -9
- data/lib/onlyoffice_webdriver_wrapper/webdriver/webdriver_move_cursor_methods.rb +19 -11
- data/lib/onlyoffice_webdriver_wrapper/webdriver.rb +4 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 776391f3667781696f5c73f6b3839fa17ed3965deaaaa53e4c0717b4915f2ced
|
4
|
+
data.tar.gz: 5d9c932257c2e35e99464657ac3c00f8069a90d40bfc7ffc0d1e1c599ab3aee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15a1d5affae01a3e6857ec9b7b592e89f9007e841f7a4d9c83043c1fc020b1086f6d9b59594f94239a47469d727db095d83187a3e2f9e25fd2caba632d958dbc
|
7
|
+
data.tar.gz: d313861c4bda34d5452b95e9caaf29a53c13899f53d16fb95d699c98ead637311ff28b67b8533a7718f746c6eeb576f078a8dd6df211f48f6f88d62a97288326
|
@@ -50,10 +50,8 @@ module OnlyofficeWebdriverWrapper
|
|
50
50
|
# @return [nil]
|
51
51
|
def click_on_locator_coordinates(xpath_name, right_by, down_by)
|
52
52
|
wait_until_element_visible(xpath_name)
|
53
|
-
|
54
|
-
|
55
|
-
@driver.action.move_to(element, right_by.to_i - shift_to_zero.x, down_by.to_i - shift_to_zero.y).perform
|
56
|
-
@driver.action.move_to(element, right_by.to_i - shift_to_zero.x, down_by.to_i - shift_to_zero.y).click.perform
|
53
|
+
move_to_driver_action(xpath_name, right_by, down_by).perform
|
54
|
+
move_to_driver_action(xpath_name, right_by, down_by).click.perform
|
57
55
|
end
|
58
56
|
|
59
57
|
# Click on one of several which displayed
|
@@ -100,10 +98,8 @@ module OnlyofficeWebdriverWrapper
|
|
100
98
|
# @return [nil]
|
101
99
|
def right_click_on_locator_coordinates(xpath_name, right_by = nil, down_by = nil)
|
102
100
|
wait_until_element_visible(xpath_name)
|
103
|
-
|
104
|
-
|
105
|
-
@driver.action.move_to(element, right_by.to_i - shift_to_zero.x, down_by.to_i - shift_to_zero.y).perform
|
106
|
-
@driver.action.move_to(element, right_by.to_i - shift_to_zero.x, down_by.to_i - shift_to_zero.y).context_click.perform
|
101
|
+
move_to_driver_action(xpath_name, right_by, down_by).perform
|
102
|
+
move_to_driver_action(xpath_name, right_by, down_by).context_click.perform
|
107
103
|
end
|
108
104
|
|
109
105
|
# Perform double_click on element
|
@@ -121,7 +117,7 @@ module OnlyofficeWebdriverWrapper
|
|
121
117
|
# @return [nil]
|
122
118
|
def double_click_on_locator_coordinates(xpath_name, right_by, down_by)
|
123
119
|
wait_until_element_visible(xpath_name)
|
124
|
-
|
120
|
+
move_to_driver_action(xpath_name, right_by, down_by).double_click.perform
|
125
121
|
end
|
126
122
|
end
|
127
123
|
end
|
@@ -14,13 +14,9 @@ module OnlyofficeWebdriverWrapper
|
|
14
14
|
# * +y2+ - shift vector y coordinate
|
15
15
|
# * +mouse_release+ - release mouse after move
|
16
16
|
def drag_and_drop(xpath, x1, y1, x2, y2, mouse_release: true)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
.move_to(canvas, x1.to_i - shift_to_zero.x,
|
21
|
-
y1.to_i - shift_to_zero.y)
|
22
|
-
.click_and_hold
|
23
|
-
.move_by(x2, y2)
|
17
|
+
move_action = move_to_driver_action(xpath, x1, y1)
|
18
|
+
.click_and_hold
|
19
|
+
.move_by(x2, y2)
|
24
20
|
move_action = move_action.release if mouse_release
|
25
21
|
|
26
22
|
move_action.perform
|
@@ -56,12 +52,11 @@ module OnlyofficeWebdriverWrapper
|
|
56
52
|
# @return [nil]
|
57
53
|
def mouse_over(xpath_name, x_coordinate = 0, y_coordinate = 0)
|
58
54
|
wait_until_element_present(xpath_name)
|
59
|
-
|
60
|
-
@driver.action.move_to(@driver.find_element(:xpath, xpath_name),
|
61
|
-
x_coordinate.to_i - shift_to_zero.x,
|
62
|
-
y_coordinate.to_i - shift_to_zero.y).perform
|
55
|
+
move_to_driver_action(xpath_name, x_coordinate, y_coordinate).perform
|
63
56
|
end
|
64
57
|
|
58
|
+
private
|
59
|
+
|
65
60
|
# Since v4.3.0 of `webdriver` gem `move_to` method is moving
|
66
61
|
# from the center of the element
|
67
62
|
# Add additional negative shift if this version is used
|
@@ -73,5 +68,18 @@ module OnlyofficeWebdriverWrapper
|
|
73
68
|
Dimensions.new(0, 0)
|
74
69
|
end
|
75
70
|
end
|
71
|
+
|
72
|
+
# Generate action to move cursor to element
|
73
|
+
# @param [String] xpath xpath to move
|
74
|
+
# @param [Integer] right_by shift vector x coordinate
|
75
|
+
# @param [Integer] down_by shift vector y coordinate
|
76
|
+
# @return [Selenium::WebDriver::ActionBuilder] object to perform actions
|
77
|
+
def move_to_driver_action(xpath, right_by, down_by)
|
78
|
+
element = @driver.find_element(:xpath, xpath)
|
79
|
+
shift_to_zero = move_to_shift_to_top_left(xpath)
|
80
|
+
@driver.action.move_to(element,
|
81
|
+
right_by.to_i - shift_to_zero.x,
|
82
|
+
down_by.to_i - shift_to_zero.y)
|
83
|
+
end
|
76
84
|
end
|
77
85
|
end
|
@@ -169,8 +169,7 @@ module OnlyofficeWebdriverWrapper
|
|
169
169
|
set_style_attribute("#{xpath_name}/button", 'display', 'inline-block')
|
170
170
|
set_style_attribute(xpath_name, 'display', 'block')
|
171
171
|
else
|
172
|
-
|
173
|
-
@driver.action.move_to(element, horizontal_shift - shift_to_zero.x, vertical_shift - shift_to_zero.y).click.perform
|
172
|
+
move_to_driver_action(xpath_name, horizontal_shift, vertical_shift).click.perform
|
174
173
|
end
|
175
174
|
end
|
176
175
|
|
@@ -183,14 +182,11 @@ module OnlyofficeWebdriverWrapper
|
|
183
182
|
# @return [void]
|
184
183
|
def action_on_locator_coordinates(xpath_name, right_by, down_by, action = :click, times = 1)
|
185
184
|
wait_until_element_visible(xpath_name)
|
186
|
-
|
187
|
-
shift_to_zero = move_to_shift_to_top_left(xpath_name)
|
188
|
-
(0...times).inject(@driver.action.move_to(element,
|
189
|
-
right_by.to_i - shift_to_zero.x,
|
190
|
-
down_by.to_i - shift_to_zero.y)) { |acc, _elem| acc.send(action) }.perform
|
185
|
+
(0...times).inject(move_to_driver_action(xpath_name, right_by, down_by)) { |acc, _elem| acc.send(action) }.perform
|
191
186
|
end
|
192
187
|
|
193
188
|
# Check if element present on page
|
189
|
+
# It may be visible or invisible, but should be present in DOM tree
|
194
190
|
# @param [String] xpath_name to find element
|
195
191
|
# @return [Boolean] result of check
|
196
192
|
def element_present?(xpath_name)
|
@@ -248,6 +244,7 @@ module OnlyofficeWebdriverWrapper
|
|
248
244
|
end
|
249
245
|
|
250
246
|
# Check if element visible on page
|
247
|
+
# It should be part of DOM and should be visible on current visible part of page
|
251
248
|
# @param [String] xpath_name element to find
|
252
249
|
# @return [Boolean] result of check
|
253
250
|
def element_visible?(xpath_name)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlyoffice_webdriver_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2022-07-
|
14
|
+
date: 2022-07-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: headless
|