selenium-webdriver 2.53.4 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +24 -18
- data/README.md +2 -3
- data/lib/selenium/server.rb +64 -68
- data/lib/selenium/webdriver.rb +5 -9
- data/lib/selenium/webdriver/chrome.rb +18 -3
- data/lib/selenium/webdriver/chrome/bridge.rb +13 -16
- data/lib/selenium/webdriver/chrome/profile.rb +7 -9
- data/lib/selenium/webdriver/chrome/service.rb +8 -84
- data/lib/selenium/webdriver/common.rb +1 -2
- data/lib/selenium/webdriver/common/action_builder.rb +28 -38
- data/lib/selenium/webdriver/common/alert.rb +7 -10
- data/lib/selenium/webdriver/common/bridge_helper.rb +10 -15
- data/lib/selenium/webdriver/common/driver.rb +19 -28
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -6
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -3
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -6
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -5
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -5
- data/lib/selenium/webdriver/common/element.rb +27 -29
- data/lib/selenium/webdriver/common/error.rb +17 -20
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -9
- data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -8
- data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -8
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +6 -15
- data/lib/selenium/webdriver/common/keyboard.rb +7 -12
- data/lib/selenium/webdriver/common/keys.rb +67 -69
- data/lib/selenium/webdriver/common/log_entry.rb +3 -4
- data/lib/selenium/webdriver/common/logs.rb +2 -4
- data/lib/selenium/webdriver/common/mouse.rb +9 -12
- data/lib/selenium/webdriver/common/navigation.rb +2 -4
- data/lib/selenium/webdriver/common/options.rb +16 -19
- data/lib/selenium/webdriver/common/platform.rb +61 -90
- data/lib/selenium/webdriver/common/port_prober.rb +1 -2
- data/lib/selenium/webdriver/common/profile_helper.rb +5 -8
- data/lib/selenium/webdriver/common/proxy.rb +58 -70
- data/lib/selenium/webdriver/common/search_context.rb +15 -19
- data/lib/selenium/webdriver/common/service.rb +127 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +5 -11
- data/lib/selenium/webdriver/common/socket_poller.rb +4 -9
- data/lib/selenium/webdriver/common/target_locator.rb +11 -13
- data/lib/selenium/webdriver/common/timeouts.rb +4 -6
- data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -4
- data/lib/selenium/webdriver/common/touch_screen.rb +15 -18
- data/lib/selenium/webdriver/common/w3c_error.rb +3 -6
- data/lib/selenium/webdriver/common/wait.rb +6 -11
- data/lib/selenium/webdriver/common/window.rb +12 -15
- data/lib/selenium/webdriver/common/zipper.rb +6 -8
- data/lib/selenium/webdriver/edge.rb +18 -3
- data/lib/selenium/webdriver/edge/bridge.rb +11 -16
- data/lib/selenium/webdriver/edge/legacy_support.rb +38 -39
- data/lib/selenium/webdriver/edge/service.rb +8 -82
- data/lib/selenium/webdriver/firefox.rb +25 -6
- data/lib/selenium/webdriver/firefox/binary.rb +37 -53
- data/lib/selenium/webdriver/firefox/bridge.rb +3 -6
- data/lib/selenium/webdriver/firefox/extension.rb +4 -6
- data/lib/selenium/webdriver/firefox/extension/prefs.json +1 -10
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +8 -11
- data/lib/selenium/webdriver/firefox/profile.rb +40 -42
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -15
- data/lib/selenium/webdriver/firefox/service.rb +23 -79
- data/lib/selenium/webdriver/firefox/util.rb +0 -2
- data/lib/selenium/webdriver/firefox/w3c_bridge.rb +2 -4
- data/lib/selenium/webdriver/ie.rb +16 -7
- data/lib/selenium/webdriver/ie/bridge.rb +16 -23
- data/lib/selenium/webdriver/{iphone.rb → ie/service.rb} +26 -4
- data/lib/selenium/webdriver/phantomjs.rb +8 -3
- data/lib/selenium/webdriver/phantomjs/bridge.rb +9 -11
- data/lib/selenium/webdriver/phantomjs/service.rb +17 -81
- data/lib/selenium/webdriver/remote.rb +0 -2
- data/lib/selenium/webdriver/remote/bridge.rb +193 -191
- data/lib/selenium/webdriver/remote/capabilities.rb +60 -90
- data/lib/selenium/webdriver/remote/commands.rb +197 -192
- data/lib/selenium/webdriver/remote/http/common.rb +15 -13
- data/lib/selenium/webdriver/remote/http/curb.rb +5 -9
- data/lib/selenium/webdriver/remote/http/default.rb +32 -37
- data/lib/selenium/webdriver/remote/http/persistent.rb +4 -6
- data/lib/selenium/webdriver/remote/response.rb +13 -21
- data/lib/selenium/webdriver/remote/server_error.rb +1 -3
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +200 -195
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +38 -46
- data/lib/selenium/webdriver/remote/w3c_commands.rb +116 -113
- data/lib/selenium/webdriver/safari.rb +23 -7
- data/lib/selenium/{client/javascript_frameworks/jquery.rb → webdriver/safari/apple_bridge.rb} +28 -9
- data/lib/selenium/webdriver/safari/browser.rb +0 -2
- data/lib/selenium/webdriver/safari/{bridge.rb → legacy_bridge.rb} +12 -9
- data/lib/selenium/webdriver/safari/options.rb +3 -4
- data/lib/selenium/webdriver/safari/resources/client.js +56 -7255
- data/lib/selenium/webdriver/safari/server.rb +18 -24
- data/lib/selenium/{client/javascript_frameworks/prototype.rb → webdriver/safari/service.rb} +27 -9
- data/lib/selenium/webdriver/support.rb +1 -0
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -2
- data/lib/selenium/webdriver/support/block_event_listener.rb +1 -3
- data/lib/selenium/webdriver/support/color.rb +55 -38
- data/lib/selenium/webdriver/{android.rb → support/escaper.rb} +19 -4
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -38
- data/lib/selenium/webdriver/support/select.rb +33 -84
- data/selenium-webdriver.gemspec +23 -23
- metadata +19 -30
- data/lib/selenium-client.rb +0 -21
- data/lib/selenium/client.rb +0 -57
- data/lib/selenium/client/base.rb +0 -151
- data/lib/selenium/client/driver.rb +0 -29
- data/lib/selenium/client/errors.rb +0 -28
- data/lib/selenium/client/extensions.rb +0 -132
- data/lib/selenium/client/idiomatic.rb +0 -507
- data/lib/selenium/client/javascript_expression_builder.rb +0 -135
- data/lib/selenium/client/legacy_driver.rb +0 -1722
- data/lib/selenium/client/protocol.rb +0 -123
- data/lib/selenium/client/selenium_helper.rb +0 -49
- data/lib/selenium/rake/server_task.rb +0 -176
- data/lib/selenium/webdriver/android/bridge.rb +0 -68
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
- data/lib/selenium/webdriver/common/html5/location.rb +0 -19
- data/lib/selenium/webdriver/ie/server.rb +0 -133
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
@@ -23,7 +23,6 @@ require 'socket'
|
|
23
23
|
module Selenium
|
24
24
|
module WebDriver
|
25
25
|
class SocketPoller
|
26
|
-
|
27
26
|
def initialize(host, port, timeout = 0, interval = 0.25)
|
28
27
|
@host = host
|
29
28
|
@port = Integer(port)
|
@@ -50,7 +49,7 @@ module Selenium
|
|
50
49
|
#
|
51
50
|
|
52
51
|
def closed?
|
53
|
-
with_timeout {
|
52
|
+
with_timeout { !listening? }
|
54
53
|
end
|
55
54
|
|
56
55
|
private
|
@@ -81,11 +80,8 @@ module Selenium
|
|
81
80
|
begin
|
82
81
|
sock.connect_nonblock sockaddr
|
83
82
|
rescue Errno::EINPROGRESS
|
84
|
-
if IO.select(nil, [sock], nil, CONNECT_TIMEOUT)
|
85
|
-
|
86
|
-
else
|
87
|
-
raise Errno::ECONNREFUSED
|
88
|
-
end
|
83
|
+
retry if IO.select(nil, [sock], nil, CONNECT_TIMEOUT)
|
84
|
+
raise Errno::ECONNREFUSED
|
89
85
|
rescue *CONNECTED_ERRORS
|
90
86
|
# yay!
|
91
87
|
end
|
@@ -99,7 +95,7 @@ module Selenium
|
|
99
95
|
end
|
100
96
|
end
|
101
97
|
|
102
|
-
def with_timeout
|
98
|
+
def with_timeout
|
103
99
|
max_time = time_now + @timeout
|
104
100
|
|
105
101
|
(
|
@@ -118,7 +114,6 @@ module Selenium
|
|
118
114
|
def time_now
|
119
115
|
Time.now
|
120
116
|
end
|
121
|
-
|
122
117
|
end # SocketPoller
|
123
118
|
end # WebDriver
|
124
119
|
end # Selenium
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
class TargetLocator
|
23
|
-
|
24
23
|
#
|
25
24
|
# @api private
|
26
25
|
#
|
@@ -34,7 +33,7 @@ module Selenium
|
|
34
33
|
#
|
35
34
|
|
36
35
|
def frame(id)
|
37
|
-
@bridge.
|
36
|
+
@bridge.switch_to_frame id
|
38
37
|
end
|
39
38
|
|
40
39
|
#
|
@@ -42,7 +41,7 @@ module Selenium
|
|
42
41
|
#
|
43
42
|
|
44
43
|
def parent_frame
|
45
|
-
@bridge.
|
44
|
+
@bridge.switch_to_parent_frame
|
46
45
|
end
|
47
46
|
|
48
47
|
#
|
@@ -58,27 +57,27 @@ module Selenium
|
|
58
57
|
def window(id)
|
59
58
|
if block_given?
|
60
59
|
original = begin
|
61
|
-
@bridge.
|
60
|
+
@bridge.window_handle
|
62
61
|
rescue Error::NoSuchWindowError
|
63
62
|
nil
|
64
63
|
end
|
65
64
|
|
66
|
-
unless @bridge.
|
65
|
+
unless @bridge.window_handles.include? id
|
67
66
|
raise Error::NoSuchWindowError, "The specified identifier '#{id}' is not found in the window handle list"
|
68
67
|
end
|
69
68
|
|
70
|
-
@bridge.
|
69
|
+
@bridge.switch_to_window id
|
71
70
|
|
72
71
|
begin
|
73
72
|
returned = yield
|
74
73
|
ensure
|
75
|
-
current_handles = @bridge.
|
74
|
+
current_handles = @bridge.window_handles
|
76
75
|
original = current_handles.first unless current_handles.include? original
|
77
|
-
@bridge.
|
76
|
+
@bridge.switch_to_window original
|
78
77
|
returned
|
79
78
|
end
|
80
79
|
else
|
81
|
-
@bridge.
|
80
|
+
@bridge.switch_to_window id
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
@@ -89,7 +88,7 @@ module Selenium
|
|
89
88
|
#
|
90
89
|
|
91
90
|
def active_element
|
92
|
-
@bridge.
|
91
|
+
@bridge.switch_to_active_element
|
93
92
|
end
|
94
93
|
|
95
94
|
#
|
@@ -97,7 +96,7 @@ module Selenium
|
|
97
96
|
#
|
98
97
|
|
99
98
|
def default_content
|
100
|
-
@bridge.
|
99
|
+
@bridge.switch_to_default_content
|
101
100
|
end
|
102
101
|
|
103
102
|
#
|
@@ -107,7 +106,6 @@ module Selenium
|
|
107
106
|
def alert
|
108
107
|
Alert.new(@bridge)
|
109
108
|
end
|
110
|
-
|
111
109
|
end # TargetLocator
|
112
110
|
end # WebDriver
|
113
|
-
end
|
111
|
+
end # Selenium
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
class Timeouts
|
23
|
-
|
24
23
|
def initialize(bridge)
|
25
24
|
@bridge = bridge
|
26
25
|
end
|
@@ -30,7 +29,7 @@ module Selenium
|
|
30
29
|
#
|
31
30
|
|
32
31
|
def implicit_wait=(seconds)
|
33
|
-
@bridge.
|
32
|
+
@bridge.implicit_wait_timeout = Integer(seconds * 1000)
|
34
33
|
end
|
35
34
|
|
36
35
|
#
|
@@ -40,7 +39,7 @@ module Selenium
|
|
40
39
|
#
|
41
40
|
|
42
41
|
def script_timeout=(seconds)
|
43
|
-
@bridge.
|
42
|
+
@bridge.script_timeout = Integer(seconds * 1000)
|
44
43
|
end
|
45
44
|
|
46
45
|
#
|
@@ -49,9 +48,8 @@ module Selenium
|
|
49
48
|
#
|
50
49
|
|
51
50
|
def page_load=(seconds)
|
52
|
-
@bridge.
|
51
|
+
@bridge.timeout 'page load', Integer(seconds * 1000)
|
53
52
|
end
|
54
|
-
|
55
53
|
end # Timeouts
|
56
54
|
end # WebDriver
|
57
|
-
end # Selenium
|
55
|
+
end # Selenium
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
class TouchActionBuilder < ActionBuilder
|
23
|
-
|
24
23
|
#
|
25
24
|
# @api private
|
26
25
|
#
|
@@ -31,7 +30,7 @@ module Selenium
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def scroll(*args)
|
34
|
-
unless [2,3].include? args.size
|
33
|
+
unless [2, 3].include? args.size
|
35
34
|
raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}"
|
36
35
|
end
|
37
36
|
|
@@ -40,7 +39,7 @@ module Selenium
|
|
40
39
|
end
|
41
40
|
|
42
41
|
def flick(*args)
|
43
|
-
unless [2,4].include? args.size
|
42
|
+
unless [2, 4].include? args.size
|
44
43
|
raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
|
45
44
|
end
|
46
45
|
|
@@ -77,7 +76,6 @@ module Selenium
|
|
77
76
|
@actions << [:touch_screen, :move, [x, y]]
|
78
77
|
self
|
79
78
|
end
|
80
|
-
|
81
79
|
end # TouchActionBuilder
|
82
80
|
end # WebDriver
|
83
81
|
end # Selenium
|
@@ -20,8 +20,7 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
class TouchScreen
|
23
|
-
FLICK_SPEED = {
|
24
|
-
|
23
|
+
FLICK_SPEED = {normal: 0, fast: 1}.freeze
|
25
24
|
|
26
25
|
#
|
27
26
|
# @api private
|
@@ -33,43 +32,43 @@ module Selenium
|
|
33
32
|
|
34
33
|
def single_tap(element)
|
35
34
|
assert_element element
|
36
|
-
@bridge.
|
35
|
+
@bridge.touch_single_tap element.ref
|
37
36
|
end
|
38
37
|
|
39
38
|
def double_tap(element)
|
40
39
|
assert_element element
|
41
|
-
@bridge.
|
40
|
+
@bridge.touch_double_tap element.ref
|
42
41
|
end
|
43
42
|
|
44
43
|
def long_press(element)
|
45
44
|
assert_element element
|
46
|
-
@bridge.
|
45
|
+
@bridge.touch_long_press element.ref
|
47
46
|
end
|
48
47
|
|
49
48
|
def down(x, y = nil)
|
50
49
|
x, y = coords_from x, y
|
51
|
-
@bridge.
|
50
|
+
@bridge.touch_down x, y
|
52
51
|
end
|
53
52
|
|
54
53
|
def up(x, y = nil)
|
55
54
|
x, y = coords_from x, y
|
56
|
-
@bridge.
|
55
|
+
@bridge.touch_up x, y
|
57
56
|
end
|
58
57
|
|
59
58
|
def move(x, y = nil)
|
60
59
|
x, y = coords_from x, y
|
61
|
-
@bridge.
|
60
|
+
@bridge.touch_move x, y
|
62
61
|
end
|
63
62
|
|
64
63
|
def scroll(*args)
|
65
64
|
case args.size
|
66
65
|
when 2
|
67
66
|
x_offset, y_offset = args
|
68
|
-
@bridge.
|
67
|
+
@bridge.touch_scroll nil, Integer(x_offset), Integer(y_offset)
|
69
68
|
when 3
|
70
69
|
element, x_offset, y_offset = args
|
71
70
|
assert_element element
|
72
|
-
@bridge.
|
71
|
+
@bridge.touch_scroll element.ref, Integer(x_offset), Integer(y_offset)
|
73
72
|
else
|
74
73
|
raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}"
|
75
74
|
end
|
@@ -79,7 +78,7 @@ module Selenium
|
|
79
78
|
case args.size
|
80
79
|
when 2
|
81
80
|
x_speed, y_speed = args
|
82
|
-
@bridge.
|
81
|
+
@bridge.touch_flick Integer(x_speed), Integer(y_speed)
|
83
82
|
when 4
|
84
83
|
element, xoffset, yoffset, speed = args
|
85
84
|
|
@@ -90,11 +89,10 @@ module Selenium
|
|
90
89
|
raise ArgumentError, "expected one of #{FLICK_SPEED.keys.inspect}, got #{speed.inspect}"
|
91
90
|
end
|
92
91
|
|
93
|
-
@bridge.
|
92
|
+
@bridge.touch_element_flick element.ref, Integer(xoffset), Integer(yoffset), flick_speed
|
94
93
|
else
|
95
94
|
raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
|
96
95
|
end
|
97
|
-
|
98
96
|
end
|
99
97
|
|
100
98
|
private
|
@@ -107,18 +105,17 @@ module Selenium
|
|
107
105
|
raise ArgumentError, "expected #{point.inspect} to respond to :x and :y"
|
108
106
|
end
|
109
107
|
|
110
|
-
x
|
108
|
+
x = point.x
|
109
|
+
y = point.y
|
111
110
|
end
|
112
111
|
|
113
112
|
[Integer(x), Integer(y)]
|
114
113
|
end
|
115
114
|
|
116
115
|
def assert_element(element)
|
117
|
-
|
118
|
-
|
119
|
-
end
|
116
|
+
return if element.is_a? Element
|
117
|
+
raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
|
120
118
|
end
|
121
|
-
|
122
119
|
end # TouchScreen
|
123
120
|
end # WebDriver
|
124
121
|
end # Selenium
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Error
|
23
|
-
|
24
23
|
class WebDriverError < StandardError; end
|
25
24
|
|
26
25
|
#
|
@@ -71,7 +70,7 @@ module Selenium
|
|
71
70
|
|
72
71
|
#
|
73
72
|
# Occurs if the given session id is not in the list of active sessions,
|
74
|
-
# meaning the session either does not exist or that it
|
73
|
+
# meaning the session either does not exist or that it's not active.
|
75
74
|
#
|
76
75
|
|
77
76
|
class InvalidSessionIdError < WebDriverError; end
|
@@ -83,7 +82,7 @@ module Selenium
|
|
83
82
|
class JavascriptError < WebDriverError; end
|
84
83
|
|
85
84
|
#
|
86
|
-
# The target for mouse interaction is not in the browser
|
85
|
+
# The target for mouse interaction is not in the browser's viewport and
|
87
86
|
# cannot be brought into that viewport.
|
88
87
|
#
|
89
88
|
|
@@ -142,7 +141,7 @@ module Selenium
|
|
142
141
|
class TimeoutError < WebDriverError; end
|
143
142
|
|
144
143
|
#
|
145
|
-
# A request to set a cookie
|
144
|
+
# A request to set a cookie's value could not be satisfied.
|
146
145
|
#
|
147
146
|
|
148
147
|
class UnableToSetCookieError < WebDriverError; end
|
@@ -187,8 +186,6 @@ module Selenium
|
|
187
186
|
UnexpectedJavascriptError = JavascriptError
|
188
187
|
NoAlertOpenError = NoAlertPresentError
|
189
188
|
ElementNotDisplayedError = ElementNotVisibleError
|
190
|
-
|
191
|
-
|
192
189
|
end # Error
|
193
190
|
end # WebDriver
|
194
191
|
end # Selenium
|
@@ -20,7 +20,6 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
class Wait
|
23
|
-
|
24
23
|
DEFAULT_TIMEOUT = 5
|
25
24
|
DEFAULT_INTERVAL = 0.2
|
26
25
|
|
@@ -41,7 +40,6 @@ module Selenium
|
|
41
40
|
@ignored = Array(opts[:ignore] || Error::NoSuchElementError)
|
42
41
|
end
|
43
42
|
|
44
|
-
|
45
43
|
#
|
46
44
|
# Wait until the given block returns a true value.
|
47
45
|
#
|
@@ -49,7 +47,7 @@ module Selenium
|
|
49
47
|
# @return [Object] the result of the block
|
50
48
|
#
|
51
49
|
|
52
|
-
def until
|
50
|
+
def until
|
53
51
|
end_time = Time.now + @timeout
|
54
52
|
last_error = nil
|
55
53
|
|
@@ -64,19 +62,16 @@ module Selenium
|
|
64
62
|
sleep @interval
|
65
63
|
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
65
|
+
msg = if @message
|
66
|
+
@message.dup
|
67
|
+
else
|
68
|
+
"timed out after #{@timeout} seconds"
|
69
|
+
end
|
73
70
|
|
74
71
|
msg << " (#{last_error.message})" if last_error
|
75
72
|
|
76
73
|
raise Error::TimeOutError, msg
|
77
74
|
end
|
78
|
-
|
79
75
|
end # Wait
|
80
76
|
end # WebDriver
|
81
77
|
end # Selenium
|
82
|
-
|
@@ -19,13 +19,11 @@
|
|
19
19
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
|
-
|
23
22
|
#
|
24
23
|
# @api beta This API may be changed or removed in a future release.
|
25
24
|
#
|
26
25
|
|
27
26
|
class Window
|
28
|
-
|
29
27
|
#
|
30
28
|
# @api private
|
31
29
|
#
|
@@ -42,11 +40,11 @@ module Selenium
|
|
42
40
|
|
43
41
|
def size=(dimension)
|
44
42
|
unless dimension.respond_to?(:width) && dimension.respond_to?(:height)
|
45
|
-
raise ArgumentError, "expected #{dimension.inspect}:#{dimension.class}"
|
46
|
-
|
43
|
+
raise ArgumentError, "expected #{dimension.inspect}:#{dimension.class}" \
|
44
|
+
' to respond to #width and #height'
|
47
45
|
end
|
48
46
|
|
49
|
-
@bridge.
|
47
|
+
@bridge.resize_window dimension.width, dimension.height
|
50
48
|
end
|
51
49
|
|
52
50
|
#
|
@@ -56,7 +54,7 @@ module Selenium
|
|
56
54
|
#
|
57
55
|
|
58
56
|
def size
|
59
|
-
@bridge.
|
57
|
+
@bridge.window_size
|
60
58
|
end
|
61
59
|
|
62
60
|
#
|
@@ -67,11 +65,11 @@ module Selenium
|
|
67
65
|
|
68
66
|
def position=(point)
|
69
67
|
unless point.respond_to?(:x) && point.respond_to?(:y)
|
70
|
-
raise ArgumentError, "expected #{point.inspect}:#{point.class}"
|
71
|
-
|
68
|
+
raise ArgumentError, "expected #{point.inspect}:#{point.class}" \
|
69
|
+
' to respond to #x and #y'
|
72
70
|
end
|
73
71
|
|
74
|
-
@bridge.
|
72
|
+
@bridge.reposition_window point.x, point.y
|
75
73
|
end
|
76
74
|
|
77
75
|
#
|
@@ -81,7 +79,7 @@ module Selenium
|
|
81
79
|
#
|
82
80
|
|
83
81
|
def position
|
84
|
-
@bridge.
|
82
|
+
@bridge.window_position
|
85
83
|
end
|
86
84
|
|
87
85
|
#
|
@@ -94,7 +92,7 @@ module Selenium
|
|
94
92
|
#
|
95
93
|
|
96
94
|
def resize_to(width, height)
|
97
|
-
@bridge.
|
95
|
+
@bridge.resize_window Integer(width), Integer(height)
|
98
96
|
end
|
99
97
|
|
100
98
|
#
|
@@ -106,7 +104,7 @@ module Selenium
|
|
106
104
|
#
|
107
105
|
|
108
106
|
def move_to(x, y)
|
109
|
-
@bridge.
|
107
|
+
@bridge.reposition_window Integer(x), Integer(y)
|
110
108
|
end
|
111
109
|
|
112
110
|
#
|
@@ -114,7 +112,7 @@ module Selenium
|
|
114
112
|
#
|
115
113
|
|
116
114
|
def maximize
|
117
|
-
@bridge.
|
115
|
+
@bridge.maximize_window
|
118
116
|
end
|
119
117
|
|
120
118
|
#
|
@@ -122,9 +120,8 @@ module Selenium
|
|
122
120
|
#
|
123
121
|
|
124
122
|
def full_screen
|
125
|
-
@bridge.
|
123
|
+
@bridge.full_screen_window
|
126
124
|
end
|
127
|
-
|
128
125
|
end # Window
|
129
126
|
end # WebDriver
|
130
127
|
end # Selenium
|