selenium-webdriver 3.141.0 → 3.142.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +125 -0
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/lib/selenium-webdriver.rb +2 -0
- data/lib/selenium/server.rb +9 -7
- data/lib/selenium/webdriver.rb +3 -1
- data/lib/selenium/webdriver/atoms.rb +20 -1
- data/lib/selenium/webdriver/atoms/getAttribute.js +6 -7
- data/lib/selenium/webdriver/atoms/isDisplayed.js +60 -59
- data/lib/selenium/webdriver/chrome.rb +10 -4
- data/lib/selenium/webdriver/chrome/bridge.rb +5 -3
- data/lib/selenium/webdriver/chrome/driver.rb +10 -13
- data/lib/selenium/webdriver/chrome/options.rb +4 -4
- data/lib/selenium/webdriver/chrome/profile.rb +4 -3
- data/lib/selenium/webdriver/chrome/service.rb +13 -13
- data/lib/selenium/webdriver/common.rb +4 -2
- data/lib/selenium/webdriver/common/action_builder.rb +2 -0
- data/lib/selenium/webdriver/common/alert.rb +2 -0
- data/lib/selenium/webdriver/common/bridge_helper.rb +8 -5
- data/lib/selenium/webdriver/common/driver.rb +22 -7
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -3
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -1
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -3
- data/lib/selenium/webdriver/common/element.rb +3 -1
- data/lib/selenium/webdriver/common/error.rb +74 -18
- data/lib/selenium/webdriver/common/file_reaper.rb +3 -3
- data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -0
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +4 -1
- data/lib/selenium/webdriver/common/interactions/input_device.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/interactions.rb +3 -1
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +4 -0
- data/lib/selenium/webdriver/common/interactions/none_input.rb +3 -0
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +2 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +7 -0
- data/lib/selenium/webdriver/common/keyboard.rb +4 -1
- data/lib/selenium/webdriver/common/keys.rb +3 -0
- data/lib/selenium/webdriver/common/log_entry.rb +4 -2
- data/lib/selenium/webdriver/common/logger.rb +15 -40
- data/lib/selenium/webdriver/common/logs.rb +2 -0
- data/lib/selenium/webdriver/common/{options.rb → manager.rb} +27 -1
- data/lib/selenium/webdriver/common/mouse.rb +3 -0
- data/lib/selenium/webdriver/common/navigation.rb +2 -0
- data/lib/selenium/webdriver/common/platform.rb +26 -30
- data/lib/selenium/webdriver/common/port_prober.rb +6 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
- data/lib/selenium/webdriver/common/proxy.rb +13 -5
- data/lib/selenium/webdriver/common/search_context.rb +6 -8
- data/lib/selenium/webdriver/common/service.rb +87 -29
- data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
- data/lib/selenium/webdriver/common/socket_poller.rb +26 -18
- data/lib/selenium/webdriver/common/target_locator.rb +6 -4
- data/lib/selenium/webdriver/common/timeouts.rb +2 -0
- data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
- data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
- data/lib/selenium/webdriver/common/{w3c_options.rb → w3c_manager.rb} +3 -1
- data/lib/selenium/webdriver/common/wait.rb +13 -5
- data/lib/selenium/webdriver/common/window.rb +2 -0
- data/lib/selenium/webdriver/common/zipper.rb +3 -3
- data/lib/selenium/webdriver/edge.rb +11 -5
- data/lib/selenium/webdriver/edge/bridge.rb +2 -0
- data/lib/selenium/webdriver/edge/driver.rb +5 -12
- data/lib/selenium/webdriver/edge/options.rb +3 -0
- data/lib/selenium/webdriver/edge/service.rb +8 -12
- data/lib/selenium/webdriver/firefox.rb +10 -4
- data/lib/selenium/webdriver/firefox/binary.rb +7 -6
- data/lib/selenium/webdriver/firefox/bridge.rb +47 -0
- data/lib/selenium/webdriver/firefox/driver.rb +2 -0
- data/lib/selenium/webdriver/firefox/extension.rb +4 -4
- data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +5 -11
- data/lib/selenium/webdriver/firefox/options.rb +20 -7
- data/lib/selenium/webdriver/firefox/profile.rb +7 -8
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
- data/lib/selenium/webdriver/firefox/service.rb +8 -19
- data/lib/selenium/webdriver/firefox/util.rb +2 -0
- data/lib/selenium/webdriver/ie.rb +10 -4
- data/lib/selenium/webdriver/ie/driver.rb +4 -10
- data/lib/selenium/webdriver/ie/options.rb +4 -2
- data/lib/selenium/webdriver/ie/service.rb +8 -12
- data/lib/selenium/webdriver/remote.rb +2 -0
- data/lib/selenium/webdriver/remote/bridge.rb +6 -4
- data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
- data/lib/selenium/webdriver/remote/commands.rb +156 -0
- data/lib/selenium/webdriver/remote/driver.rb +2 -0
- data/lib/selenium/webdriver/remote/http/common.rb +11 -4
- data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
- data/lib/selenium/webdriver/remote/http/default.rb +31 -25
- data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
- data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
- data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
- data/lib/selenium/webdriver/remote/response.rb +11 -3
- data/lib/selenium/webdriver/remote/server_error.rb +2 -0
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
- data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
- data/lib/selenium/webdriver/safari.rb +11 -4
- data/lib/selenium/webdriver/safari/bridge.rb +5 -3
- data/lib/selenium/webdriver/safari/driver.rb +8 -10
- data/lib/selenium/webdriver/safari/options.rb +2 -0
- data/lib/selenium/webdriver/safari/service.rb +6 -25
- data/lib/selenium/webdriver/support.rb +2 -0
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
- data/lib/selenium/webdriver/support/color.rb +11 -9
- data/lib/selenium/webdriver/support/escaper.rb +2 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
- data/lib/selenium/webdriver/support/select.rb +19 -18
- data/lib/selenium/webdriver/version.rb +3 -1
- data/selenium-webdriver.gemspec +14 -7
- metadata +89 -23
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -29,7 +31,7 @@ module Selenium
|
|
29
31
|
|
30
32
|
class Capabilities
|
31
33
|
|
32
|
-
EXTENSION_CAPABILITY_PATTERN = /\A[\w-]+:.*\z
|
34
|
+
EXTENSION_CAPABILITY_PATTERN = /\A[\w-]+:.*\z/.freeze
|
33
35
|
|
34
36
|
KNOWN = [
|
35
37
|
:browser_name,
|
@@ -41,18 +43,19 @@ module Selenium
|
|
41
43
|
:set_window_rect,
|
42
44
|
:timeouts,
|
43
45
|
:unhandled_prompt_behavior,
|
46
|
+
:strict_file_interactability,
|
44
47
|
|
45
48
|
# remote-specific
|
46
49
|
:remote_session_id,
|
47
50
|
|
48
|
-
# TODO (alex)
|
51
|
+
# TODO: (alex) deprecate in favor of Firefox::Options?
|
49
52
|
:accessibility_checks,
|
50
53
|
:device,
|
51
54
|
|
52
|
-
# TODO (alex)
|
55
|
+
# TODO: (alex) deprecate compatibility with OSS-capabilities
|
53
56
|
:implicit_timeout,
|
54
57
|
:page_load_timeout,
|
55
|
-
:script_timeout
|
58
|
+
:script_timeout
|
56
59
|
].freeze
|
57
60
|
|
58
61
|
KNOWN.each do |key|
|
@@ -61,7 +64,14 @@ module Selenium
|
|
61
64
|
end
|
62
65
|
|
63
66
|
next if key == :proxy
|
67
|
+
|
64
68
|
define_method "#{key}=" do |value|
|
69
|
+
case key
|
70
|
+
when :accessibility_checks
|
71
|
+
WebDriver.logger.deprecate(":accessibility_checks capability")
|
72
|
+
when :device
|
73
|
+
WebDriver.logger.deprecate(":device capability")
|
74
|
+
end
|
65
75
|
@capabilities[key] = value
|
66
76
|
end
|
67
77
|
end
|
@@ -81,20 +91,15 @@ module Selenium
|
|
81
91
|
|
82
92
|
class << self
|
83
93
|
def edge(opts = {})
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
}.merge(opts))
|
94
|
+
WebDriver.logger.deprecate('Selenium::WebDriver::Remote::W3C::Capabilities.edge',
|
95
|
+
'Selenium::WebDriver::Remote::Capabilities.edge')
|
96
|
+
Remote::Capabilities.edge(opts)
|
88
97
|
end
|
89
98
|
|
90
99
|
def firefox(opts = {})
|
91
|
-
|
92
|
-
|
93
|
-
opts
|
94
|
-
opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
|
95
|
-
opts[:timeouts]['pageLoad'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
|
96
|
-
opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
|
97
|
-
new({browser_name: 'firefox', marionette: true}.merge(opts))
|
100
|
+
WebDriver.logger.deprecate('Selenium::WebDriver::Remote::W3C::Capabilities.firefox',
|
101
|
+
'Selenium::WebDriver::Remote::Capabilities.firefox')
|
102
|
+
Remote::Capabilities.firefox(opts)
|
98
103
|
end
|
99
104
|
|
100
105
|
alias_method :ff, :firefox
|
@@ -140,10 +145,10 @@ module Selenium
|
|
140
145
|
# @param oss_capabilities [Hash, Remote::Capabilities]
|
141
146
|
#
|
142
147
|
|
143
|
-
def from_oss(oss_capabilities)
|
148
|
+
def from_oss(oss_capabilities) # rubocop:disable Metrics/MethodLength
|
144
149
|
w3c_capabilities = new
|
145
150
|
|
146
|
-
# TODO (alex)
|
151
|
+
# TODO: (alex) make capabilities enumerable?
|
147
152
|
oss_capabilities = oss_capabilities.__send__(:capabilities) unless oss_capabilities.is_a?(Hash)
|
148
153
|
oss_capabilities.each do |name, value|
|
149
154
|
next if value.nil?
|
@@ -163,11 +168,23 @@ module Selenium
|
|
163
168
|
|
164
169
|
# User can pass :firefox_options or :firefox_profile.
|
165
170
|
#
|
166
|
-
# TODO (alex)
|
171
|
+
# TODO: (alex) Refactor this whole method into converter class.
|
167
172
|
firefox_options = oss_capabilities['firefoxOptions'] || oss_capabilities['firefox_options'] || oss_capabilities[:firefox_options]
|
168
173
|
firefox_profile = oss_capabilities['firefox_profile'] || oss_capabilities[:firefox_profile]
|
169
174
|
firefox_binary = oss_capabilities['firefox_binary'] || oss_capabilities[:firefox_binary]
|
170
175
|
|
176
|
+
if firefox_options
|
177
|
+
WebDriver.logger.deprecate(':firefox_options capabilitiy', 'Selenium::WebDriver::Firefox::Options')
|
178
|
+
end
|
179
|
+
|
180
|
+
if firefox_profile
|
181
|
+
WebDriver.logger.deprecate(':firefox_profile capabilitiy', 'Selenium::WebDriver::Firefox::Options#profile')
|
182
|
+
end
|
183
|
+
|
184
|
+
if firefox_binary
|
185
|
+
WebDriver.logger.deprecate(':firefox_binary capabilitiy', 'Selenium::WebDriver::Firefox::Options#binary')
|
186
|
+
end
|
187
|
+
|
171
188
|
if firefox_profile && firefox_options
|
172
189
|
second_profile = firefox_options['profile'] || firefox_options[:profile]
|
173
190
|
if second_profile && firefox_profile != second_profile
|
@@ -250,9 +267,7 @@ module Selenium
|
|
250
267
|
if value
|
251
268
|
hash['proxy'] = value.as_json
|
252
269
|
hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
|
253
|
-
if hash['proxy']['noProxy'].is_a?(String)
|
254
|
-
hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ')
|
255
|
-
end
|
270
|
+
hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ') if hash['proxy']['noProxy'].is_a?(String)
|
256
271
|
end
|
257
272
|
when String, :firefox_binary
|
258
273
|
hash[key.to_s] = value
|
@@ -272,6 +287,7 @@ module Selenium
|
|
272
287
|
|
273
288
|
def ==(other)
|
274
289
|
return false unless other.is_a? self.class
|
290
|
+
|
275
291
|
as_json == other.as_json
|
276
292
|
end
|
277
293
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -32,119 +34,120 @@ module Selenium
|
|
32
34
|
# session handling
|
33
35
|
#
|
34
36
|
|
35
|
-
new_session: [:post, 'session'
|
36
|
-
delete_session: [:delete, 'session/:session_id'
|
37
|
+
new_session: [:post, 'session'],
|
38
|
+
delete_session: [:delete, 'session/:session_id'],
|
37
39
|
|
38
40
|
#
|
39
41
|
# basic driver
|
40
42
|
#
|
41
43
|
|
42
|
-
get: [:post, 'session/:session_id/url'
|
43
|
-
get_current_url: [:get, 'session/:session_id/url'
|
44
|
-
back: [:post, 'session/:session_id/back'
|
45
|
-
forward: [:post, 'session/:session_id/forward'
|
46
|
-
refresh: [:post, 'session/:session_id/refresh'
|
47
|
-
get_title: [:get, 'session/:session_id/title'
|
44
|
+
get: [:post, 'session/:session_id/url'],
|
45
|
+
get_current_url: [:get, 'session/:session_id/url'],
|
46
|
+
back: [:post, 'session/:session_id/back'],
|
47
|
+
forward: [:post, 'session/:session_id/forward'],
|
48
|
+
refresh: [:post, 'session/:session_id/refresh'],
|
49
|
+
get_title: [:get, 'session/:session_id/title'],
|
48
50
|
|
49
51
|
#
|
50
52
|
# window and Frame handling
|
51
53
|
#
|
52
54
|
|
53
|
-
get_window_handle: [:get, 'session/:session_id/window'
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
55
|
+
get_window_handle: [:get, 'session/:session_id/window'],
|
56
|
+
new_window: [:post, 'session/:session_id/window/new'],
|
57
|
+
close_window: [:delete, 'session/:session_id/window'],
|
58
|
+
switch_to_window: [:post, 'session/:session_id/window'],
|
59
|
+
get_window_handles: [:get, 'session/:session_id/window/handles'],
|
60
|
+
fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
|
61
|
+
minimize_window: [:post, 'session/:session_id/window/minimize'],
|
62
|
+
maximize_window: [:post, 'session/:session_id/window/maximize'],
|
63
|
+
set_window_size: [:post, 'session/:session_id/window/size'],
|
64
|
+
get_window_size: [:get, 'session/:session_id/window/size'],
|
65
|
+
set_window_position: [:post, 'session/:session_id/window/position'],
|
66
|
+
get_window_position: [:get, 'session/:session_id/window/position'],
|
67
|
+
set_window_rect: [:post, 'session/:session_id/window/rect'],
|
68
|
+
get_window_rect: [:get, 'session/:session_id/window/rect'],
|
69
|
+
switch_to_frame: [:post, 'session/:session_id/frame'],
|
70
|
+
switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
|
68
71
|
|
69
72
|
#
|
70
73
|
# element
|
71
74
|
#
|
72
75
|
|
73
|
-
find_element: [:post, 'session/:session_id/element'
|
74
|
-
find_elements: [:post, 'session/:session_id/elements'
|
75
|
-
find_child_element: [:post, 'session/:session_id/element/:id/element'
|
76
|
-
find_child_elements: [:post, 'session/:session_id/element/:id/elements'
|
77
|
-
get_active_element: [:get, 'session/:session_id/element/active'
|
78
|
-
is_element_selected: [:get, 'session/:session_id/element/:id/selected'
|
79
|
-
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'
|
80
|
-
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'
|
81
|
-
get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'
|
82
|
-
get_element_text: [:get, 'session/:session_id/element/:id/text'
|
83
|
-
get_element_tag_name: [:get, 'session/:session_id/element/:id/name'
|
84
|
-
get_element_rect: [:get, 'session/:session_id/element/:id/rect'
|
85
|
-
is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'
|
76
|
+
find_element: [:post, 'session/:session_id/element'],
|
77
|
+
find_elements: [:post, 'session/:session_id/elements'],
|
78
|
+
find_child_element: [:post, 'session/:session_id/element/:id/element'],
|
79
|
+
find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
|
80
|
+
get_active_element: [:get, 'session/:session_id/element/active'],
|
81
|
+
is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
|
82
|
+
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
|
83
|
+
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
|
84
|
+
get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
|
85
|
+
get_element_text: [:get, 'session/:session_id/element/:id/text'],
|
86
|
+
get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
|
87
|
+
get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
|
88
|
+
is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
|
86
89
|
|
87
90
|
#
|
88
91
|
# document handling
|
89
92
|
#
|
90
93
|
|
91
|
-
get_page_source: [:get, 'session/:session_id/source'
|
92
|
-
execute_script: [:post, 'session/:session_id/execute/sync'
|
93
|
-
execute_async_script: [:post, 'session/:session_id/execute/async'
|
94
|
+
get_page_source: [:get, 'session/:session_id/source'],
|
95
|
+
execute_script: [:post, 'session/:session_id/execute/sync'],
|
96
|
+
execute_async_script: [:post, 'session/:session_id/execute/async'],
|
94
97
|
|
95
98
|
#
|
96
99
|
# cookies
|
97
100
|
#
|
98
101
|
|
99
|
-
get_all_cookies: [:get, 'session/:session_id/cookie'
|
100
|
-
get_cookie: [:get, 'session/:session_id/cookie/:name'
|
101
|
-
add_cookie: [:post, 'session/:session_id/cookie'
|
102
|
-
delete_cookie: [:delete, 'session/:session_id/cookie/:name'
|
103
|
-
delete_all_cookies: [:delete, 'session/:session_id/cookie'
|
102
|
+
get_all_cookies: [:get, 'session/:session_id/cookie'],
|
103
|
+
get_cookie: [:get, 'session/:session_id/cookie/:name'],
|
104
|
+
add_cookie: [:post, 'session/:session_id/cookie'],
|
105
|
+
delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
|
106
|
+
delete_all_cookies: [:delete, 'session/:session_id/cookie'],
|
104
107
|
|
105
108
|
#
|
106
109
|
# timeouts
|
107
110
|
#
|
108
111
|
|
109
|
-
set_timeout: [:post, 'session/:session_id/timeouts'
|
112
|
+
set_timeout: [:post, 'session/:session_id/timeouts'],
|
110
113
|
|
111
114
|
#
|
112
115
|
# actions
|
113
116
|
#
|
114
117
|
|
115
|
-
actions: [:post, 'session/:session_id/actions'
|
116
|
-
release_actions: [:delete, 'session/:session_id/actions'
|
118
|
+
actions: [:post, 'session/:session_id/actions'],
|
119
|
+
release_actions: [:delete, 'session/:session_id/actions'],
|
117
120
|
|
118
121
|
#
|
119
122
|
# Element Operations
|
120
123
|
#
|
121
124
|
|
122
|
-
element_click: [:post, 'session/:session_id/element/:id/click'
|
123
|
-
element_tap: [:post, 'session/:session_id/element/:id/tap'
|
124
|
-
element_clear: [:post, 'session/:session_id/element/:id/clear'
|
125
|
-
element_send_keys: [:post, 'session/:session_id/element/:id/value'
|
125
|
+
element_click: [:post, 'session/:session_id/element/:id/click'],
|
126
|
+
element_tap: [:post, 'session/:session_id/element/:id/tap'],
|
127
|
+
element_clear: [:post, 'session/:session_id/element/:id/clear'],
|
128
|
+
element_send_keys: [:post, 'session/:session_id/element/:id/value'],
|
126
129
|
|
127
130
|
#
|
128
131
|
# alerts
|
129
132
|
#
|
130
133
|
|
131
|
-
dismiss_alert: [:post, 'session/:session_id/alert/dismiss'
|
132
|
-
accept_alert: [:post, 'session/:session_id/alert/accept'
|
133
|
-
get_alert_text: [:get, 'session/:session_id/alert/text'
|
134
|
-
send_alert_text: [:post, 'session/:session_id/alert/text'
|
134
|
+
dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
|
135
|
+
accept_alert: [:post, 'session/:session_id/alert/accept'],
|
136
|
+
get_alert_text: [:get, 'session/:session_id/alert/text'],
|
137
|
+
send_alert_text: [:post, 'session/:session_id/alert/text'],
|
135
138
|
|
136
139
|
#
|
137
140
|
# screenshot
|
138
141
|
#
|
139
142
|
|
140
|
-
take_screenshot: [:get, 'session/:session_id/screenshot'
|
141
|
-
take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'
|
143
|
+
take_screenshot: [:get, 'session/:session_id/screenshot'],
|
144
|
+
take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
|
142
145
|
|
143
146
|
#
|
144
147
|
# server extensions
|
145
148
|
#
|
146
149
|
|
147
|
-
upload_file: [:post, 'session/:session_id/se/file'
|
150
|
+
upload_file: [:post, 'session/:session_id/se/file']
|
148
151
|
}.freeze
|
149
152
|
|
150
153
|
end # Bridge
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -18,7 +20,6 @@
|
|
18
20
|
require 'selenium/webdriver/safari/bridge'
|
19
21
|
require 'selenium/webdriver/safari/driver'
|
20
22
|
require 'selenium/webdriver/safari/options'
|
21
|
-
require 'selenium/webdriver/safari/service'
|
22
23
|
|
23
24
|
module Selenium
|
24
25
|
module WebDriver
|
@@ -41,18 +42,24 @@ module Selenium
|
|
41
42
|
@path ||= '/Applications/Safari.app/Contents/MacOS/Safari'
|
42
43
|
return @path if File.file?(@path) && File.executable?(@path)
|
43
44
|
raise Error::WebDriverError, 'Safari is only supported on Mac' unless Platform.os.mac?
|
45
|
+
|
44
46
|
raise Error::WebDriverError, 'Unable to find Safari'
|
45
47
|
end
|
46
48
|
|
47
49
|
def driver_path=(path)
|
48
|
-
|
49
|
-
|
50
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
|
51
|
+
'Selenium::WebDriver::Safari::Service#driver_path='
|
52
|
+
Selenium::WebDriver::Safari::Service.driver_path = path
|
50
53
|
end
|
51
54
|
|
52
55
|
def driver_path
|
53
|
-
|
56
|
+
WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
|
57
|
+
'Selenium::WebDriver::Safari::Service#driver_path'
|
58
|
+
Selenium::WebDriver::Safari::Service.driver_path
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end # Safari
|
57
62
|
end # WebDriver
|
58
63
|
end # Selenium
|
64
|
+
|
65
|
+
require 'selenium/webdriver/safari/service'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -22,9 +24,9 @@ module Selenium
|
|
22
24
|
|
23
25
|
# https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
|
24
26
|
COMMANDS = {
|
25
|
-
get_permissions: [:get, '
|
26
|
-
set_permissions: [:post, '
|
27
|
-
attach_debugger: [:post, '
|
27
|
+
get_permissions: [:get, 'session/:session_id/apple/permissions'],
|
28
|
+
set_permissions: [:post, 'session/:session_id/apple/permissions'],
|
29
|
+
attach_debugger: [:post, 'session/:session_id/apple/attach_debugger']
|
28
30
|
}.freeze
|
29
31
|
|
30
32
|
def commands(command)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -32,15 +34,7 @@ module Selenium
|
|
32
34
|
def initialize(opts = {})
|
33
35
|
opts[:desired_capabilities] = create_capabilities(opts)
|
34
36
|
|
35
|
-
|
36
|
-
driver_path = opts.delete(:driver_path) || Safari.driver_path
|
37
|
-
driver_opts = opts.delete(:driver_opts) || {}
|
38
|
-
port = opts.delete(:port) || Service::DEFAULT_PORT
|
39
|
-
|
40
|
-
@service = Service.new(driver_path, port, driver_opts)
|
41
|
-
@service.start
|
42
|
-
opts[:url] = @service.uri
|
43
|
-
end
|
37
|
+
opts[:url] ||= service_url(opts)
|
44
38
|
|
45
39
|
listener = opts.delete(:listener)
|
46
40
|
@bridge = Remote::Bridge.handshake(opts)
|
@@ -49,10 +43,14 @@ module Selenium
|
|
49
43
|
super(@bridge, listener: listener)
|
50
44
|
end
|
51
45
|
|
46
|
+
def browser
|
47
|
+
:safari
|
48
|
+
end
|
49
|
+
|
52
50
|
def quit
|
53
51
|
super
|
54
52
|
ensure
|
55
|
-
@service
|
53
|
+
@service&.stop
|
56
54
|
end
|
57
55
|
|
58
56
|
private
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Licensed to the Software Freedom Conservancy (SFC) under one
|
2
4
|
# or more contributor license agreements. See the NOTICE file
|
3
5
|
# distributed with this work for additional information
|
@@ -23,34 +25,13 @@ module Selenium
|
|
23
25
|
#
|
24
26
|
|
25
27
|
class Service < WebDriver::Service
|
26
|
-
|
27
|
-
@executable = '
|
28
|
-
@missing_text =
|
28
|
+
@default_port = 7050
|
29
|
+
@executable = 'safaridriver'
|
30
|
+
@missing_text = <<~ERROR
|
29
31
|
Unable to find Apple's safaridriver which comes with Safari 10.
|
30
32
|
More info at https://webkit.org/blog/6900/webdriver-support-in-safari-10/
|
31
33
|
ERROR
|
32
|
-
|
33
|
-
def stop
|
34
|
-
stop_process
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def binary_path(path)
|
40
|
-
path = self.class.executable if path.nil?
|
41
|
-
raise Error::WebDriverError, self.class.missing_text unless path
|
42
|
-
Platform.assert_executable path
|
43
|
-
path
|
44
|
-
end
|
45
|
-
|
46
|
-
def start_process
|
47
|
-
@process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
|
48
|
-
@process.start
|
49
|
-
end
|
50
|
-
|
51
|
-
def cannot_connect_error_text
|
52
|
-
"unable to connect to safaridriver #{@host}:#{@port}"
|
53
|
-
end
|
34
|
+
@shutdown_supported = false
|
54
35
|
end # Service
|
55
36
|
end # Safari
|
56
37
|
end # WebDriver
|