selenium-webdriver 3.0.0.beta4.0 → 4.0.0.alpha5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +679 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/README.md +1 -1
  6. data/lib/selenium-webdriver.rb +2 -2
  7. data/lib/selenium/server.rb +23 -16
  8. data/lib/selenium/webdriver.rb +43 -25
  9. data/lib/selenium/webdriver/atoms.rb +20 -1
  10. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  11. data/lib/selenium/webdriver/atoms/getAttribute.js +84 -11
  12. data/lib/selenium/webdriver/atoms/isDisplayed.js +100 -0
  13. data/lib/selenium/webdriver/chrome.rb +15 -20
  14. data/lib/selenium/webdriver/chrome/bridge.rb +29 -66
  15. data/lib/selenium/webdriver/{edge/service.rb → chrome/driver.rb} +19 -22
  16. data/lib/selenium/webdriver/chrome/options.rb +221 -0
  17. data/lib/selenium/webdriver/chrome/profile.rb +6 -7
  18. data/lib/selenium/webdriver/chrome/service.rb +20 -20
  19. data/lib/selenium/webdriver/common.rb +19 -11
  20. data/lib/selenium/webdriver/common/action_builder.rb +98 -246
  21. data/lib/selenium/webdriver/common/alert.rb +2 -7
  22. data/lib/selenium/webdriver/common/driver.rb +89 -51
  23. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +12 -25
  26. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +38 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -5
  28. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -3
  30. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -2
  32. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -2
  33. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -2
  34. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +4 -4
  35. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -3
  36. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -5
  37. data/lib/selenium/webdriver/common/element.rb +32 -10
  38. data/lib/selenium/webdriver/common/error.rb +103 -121
  39. data/lib/selenium/webdriver/common/file_reaper.rb +3 -5
  40. data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -2
  41. data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -2
  42. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +3 -2
  43. data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
  44. data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
  45. data/lib/selenium/webdriver/{phantomjs.rb → common/interactions/interactions.rb} +17 -20
  46. data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
  47. data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
  48. data/lib/selenium/webdriver/common/interactions/none_input.rb +36 -0
  49. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
  50. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
  51. data/lib/selenium/webdriver/common/keys.rb +37 -15
  52. data/lib/selenium/webdriver/common/log_entry.rb +4 -4
  53. data/lib/selenium/webdriver/common/logger.rb +147 -0
  54. data/lib/selenium/webdriver/common/logs.rb +2 -2
  55. data/lib/selenium/webdriver/common/manager.rb +177 -0
  56. data/lib/selenium/webdriver/common/navigation.rb +2 -2
  57. data/lib/selenium/webdriver/common/options.rb +47 -105
  58. data/lib/selenium/webdriver/common/platform.rb +44 -38
  59. data/lib/selenium/webdriver/common/port_prober.rb +8 -19
  60. data/lib/selenium/webdriver/common/profile_helper.rb +13 -5
  61. data/lib/selenium/webdriver/common/proxy.rb +14 -8
  62. data/lib/selenium/webdriver/common/search_context.rb +16 -20
  63. data/lib/selenium/webdriver/common/service.rb +115 -30
  64. data/lib/selenium/webdriver/common/socket_lock.rb +12 -7
  65. data/lib/selenium/webdriver/common/socket_poller.rb +29 -22
  66. data/lib/selenium/webdriver/common/target_locator.rb +6 -6
  67. data/lib/selenium/webdriver/common/timeouts.rb +2 -2
  68. data/lib/selenium/webdriver/common/wait.rb +14 -8
  69. data/lib/selenium/webdriver/common/window.rb +38 -2
  70. data/lib/selenium/webdriver/common/zipper.rb +3 -5
  71. data/lib/selenium/webdriver/edge.rb +33 -20
  72. data/lib/selenium/webdriver/edge_chrome/bridge.rb +30 -0
  73. data/lib/selenium/webdriver/edge_chrome/driver.rb +38 -0
  74. data/lib/selenium/webdriver/{common/driver_extensions/has_touch_screen.rb → edge_chrome/options.rb} +10 -12
  75. data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
  76. data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
  77. data/lib/selenium/webdriver/edge_html/driver.rb +39 -0
  78. data/lib/selenium/webdriver/edge_html/options.rb +91 -0
  79. data/lib/selenium/webdriver/edge_html/service.rb +47 -0
  80. data/lib/selenium/webdriver/firefox.rb +24 -29
  81. data/lib/selenium/webdriver/firefox/bridge.rb +15 -39
  82. data/lib/selenium/webdriver/firefox/{util.rb → driver.rb} +13 -19
  83. data/lib/selenium/webdriver/firefox/extension.rb +28 -8
  84. data/lib/selenium/webdriver/firefox/options.rb +162 -0
  85. data/lib/selenium/webdriver/firefox/profile.rb +23 -82
  86. data/lib/selenium/webdriver/firefox/profiles_ini.rb +5 -5
  87. data/lib/selenium/webdriver/firefox/service.rb +18 -37
  88. data/lib/selenium/webdriver/ie.rb +13 -19
  89. data/lib/selenium/webdriver/ie/driver.rb +40 -0
  90. data/lib/selenium/webdriver/ie/options.rb +118 -0
  91. data/lib/selenium/webdriver/ie/service.rb +20 -20
  92. data/lib/selenium/webdriver/remote.rb +15 -17
  93. data/lib/selenium/webdriver/remote/bridge.rb +281 -300
  94. data/lib/selenium/webdriver/remote/capabilities.rb +102 -83
  95. data/lib/selenium/webdriver/remote/commands.rb +132 -192
  96. data/lib/selenium/webdriver/remote/driver.rb +52 -0
  97. data/lib/selenium/webdriver/remote/http/common.rb +23 -13
  98. data/lib/selenium/webdriver/remote/http/curb.rb +10 -7
  99. data/lib/selenium/webdriver/remote/http/default.rb +52 -32
  100. data/lib/selenium/webdriver/remote/http/persistent.rb +8 -4
  101. data/lib/selenium/webdriver/remote/response.rb +32 -35
  102. data/lib/selenium/webdriver/remote/server_error.rb +2 -2
  103. data/lib/selenium/webdriver/safari.rb +24 -22
  104. data/lib/selenium/webdriver/safari/bridge.rb +21 -21
  105. data/lib/selenium/webdriver/safari/driver.rb +41 -0
  106. data/lib/selenium/webdriver/safari/options.rb +66 -0
  107. data/lib/selenium/webdriver/safari/service.rb +8 -24
  108. data/lib/selenium/webdriver/support.rb +3 -2
  109. data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -2
  110. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -3
  111. data/lib/selenium/webdriver/support/color.rb +13 -13
  112. data/lib/selenium/webdriver/support/escaper.rb +2 -2
  113. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  114. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  115. data/lib/selenium/webdriver/support/select.rb +20 -21
  116. data/lib/selenium/webdriver/version.rb +24 -0
  117. data/selenium-webdriver.gemspec +31 -17
  118. metadata +331 -248
  119. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  120. data/lib/selenium/webdriver/common/keyboard.rb +0 -69
  121. data/lib/selenium/webdriver/common/mouse.rb +0 -88
  122. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -81
  123. data/lib/selenium/webdriver/common/touch_screen.rb +0 -121
  124. data/lib/selenium/webdriver/common/w3c_error.rb +0 -191
  125. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  126. data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
  127. data/lib/selenium/webdriver/firefox/binary.rb +0 -186
  128. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  129. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  130. data/lib/selenium/webdriver/firefox/launcher.rb +0 -114
  131. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  132. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  133. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +0 -79
  134. data/lib/selenium/webdriver/ie/bridge.rb +0 -76
  135. data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -65
  136. data/lib/selenium/webdriver/phantomjs/service.rb +0 -66
  137. data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -682
  138. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -228
  139. data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -135
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -20,39 +20,55 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Remote
23
+
23
24
  #
24
25
  # Specification of the desired and/or actual capabilities of the browser that the
25
26
  # server is being asked to create.
26
27
  #
28
+
27
29
  class Capabilities
28
- DEFAULTS = {
29
- browser_name: '',
30
- version: '',
31
- platform: :any,
32
- javascript_enabled: false,
33
- css_selectors_enabled: false,
34
- takes_screenshot: false,
35
- native_events: false,
36
- rotatable: false,
37
- firefox_profile: nil,
38
- proxy: nil
39
- }.freeze
40
-
41
- DEFAULTS.each_key do |key|
30
+
31
+ KNOWN = [
32
+ :browser_name,
33
+ :browser_version,
34
+ :platform_name,
35
+ :accept_insecure_certs,
36
+ :page_load_strategy,
37
+ :proxy,
38
+ :set_window_rect,
39
+ :timeouts,
40
+ :unhandled_prompt_behavior,
41
+ :strict_file_interactability,
42
+
43
+ # remote-specific
44
+ :remote_session_id,
45
+
46
+ # TODO: (AR) deprecate compatibility with OSS-capabilities
47
+ :implicit_timeout,
48
+ :page_load_timeout,
49
+ :script_timeout
50
+ ].freeze
51
+
52
+ KNOWN.each do |key|
42
53
  define_method key do
43
54
  @capabilities.fetch(key)
44
55
  end
45
56
 
57
+ next if key == :proxy
58
+
46
59
  define_method "#{key}=" do |value|
47
60
  @capabilities[key] = value
48
61
  end
49
62
  end
50
63
 
51
- alias_method :css_selectors_enabled?, :css_selectors_enabled
52
- alias_method :javascript_enabled?, :javascript_enabled
53
- alias_method :native_events?, :native_events
54
- alias_method :takes_screenshot?, :takes_screenshot
55
- alias_method :rotatable?, :rotatable
64
+ #
65
+ # Backward compatibility
66
+ #
67
+
68
+ alias_method :version, :browser_version
69
+ alias_method :version=, :browser_version=
70
+ alias_method :platform, :platform_name
71
+ alias_method :platform=, :platform_name=
56
72
 
57
73
  #
58
74
  # Convenience methods for the common choices.
@@ -61,69 +77,60 @@ module Selenium
61
77
  class << self
62
78
  def chrome(opts = {})
63
79
  new({
64
- browser_name: 'chrome',
65
- javascript_enabled: true,
66
- css_selectors_enabled: true
80
+ browser_name: 'chrome'
67
81
  }.merge(opts))
68
82
  end
69
83
 
70
84
  def edge(opts = {})
71
- W3CCapabilities.edge(opts)
85
+ edge_html(opts)
72
86
  end
73
87
 
74
- def firefox(opts = {})
75
- return W3CCapabilities.firefox(opts) unless opts[:marionette] == false
76
-
88
+ def edge_html(opts = {})
77
89
  new({
78
- browser_name: 'firefox',
79
- javascript_enabled: true,
80
- takes_screenshot: true,
81
- css_selectors_enabled: true
90
+ browser_name: 'MicrosoftEdge',
91
+ platform_name: :windows
82
92
  }.merge(opts))
83
93
  end
84
94
 
85
- def htmlunit(opts = {})
95
+ def edge_chrome(opts = {})
86
96
  new({
87
- browser_name: 'htmlunit'
97
+ browser_name: 'MicrosoftEdge'
88
98
  }.merge(opts))
89
99
  end
90
100
 
91
- def htmlunitwithjs(opts = {})
92
- new({
93
- browser_name: 'htmlunit',
94
- javascript_enabled: true
95
- }.merge(opts))
101
+ def firefox(opts = {})
102
+ opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
103
+ opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
104
+ opts[:timeouts] = {}
105
+ opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
106
+ opts[:timeouts]['pageLoad'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
107
+ opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
108
+ opts.delete(:timeouts) if opts[:timeouts].empty?
109
+ new({browser_name: 'firefox'}.merge(opts))
96
110
  end
97
111
 
98
- def internet_explorer(opts = {})
112
+ alias_method :ff, :firefox
113
+
114
+ def safari(opts = {})
99
115
  new({
100
- browser_name: 'internet explorer',
101
- platform: :windows,
102
- takes_screenshot: true,
103
- css_selectors_enabled: true,
104
- native_events: true
116
+ browser_name: 'safari',
117
+ platform_name: :mac
105
118
  }.merge(opts))
106
119
  end
107
- alias_method :ie, :internet_explorer
108
120
 
109
- def phantomjs(opts = {})
121
+ def htmlunit(opts = {})
110
122
  new({
111
- browser_name: 'phantomjs',
112
- javascript_enabled: true,
113
- takes_screenshot: true,
114
- css_selectors_enabled: true
123
+ browser_name: 'htmlunit'
115
124
  }.merge(opts))
116
125
  end
117
126
 
118
- def safari(opts = {})
127
+ def internet_explorer(opts = {})
119
128
  new({
120
- browser_name: 'safari',
121
- platform: :mac,
122
- javascript_enabled: true,
123
- takes_screenshot: true,
124
- css_selectors_enabled: true
129
+ browser_name: 'internet explorer',
130
+ platform_name: :windows
125
131
  }.merge(opts))
126
132
  end
133
+ alias_method :ie, :internet_explorer
127
134
 
128
135
  #
129
136
  # @api private
@@ -133,15 +140,26 @@ module Selenium
133
140
  data = data.dup
134
141
 
135
142
  caps = new
136
- caps.browser_name = data.delete('browserName')
137
- caps.version = data.delete('version')
138
- caps.platform = data.delete('platform').downcase.to_sym if data.key?('platform')
139
- caps.javascript_enabled = data.delete('javascriptEnabled')
140
- caps.css_selectors_enabled = data.delete('cssSelectorsEnabled')
141
- caps.takes_screenshot = data.delete('takesScreenshot')
142
- caps.native_events = data.delete('nativeEvents')
143
- caps.rotatable = data.delete('rotatable')
144
- caps.proxy = Proxy.json_create(data['proxy']) if data.key?('proxy') && !data['proxy'].empty?
143
+ caps.browser_name = data.delete('browserName') if data.key?('browserName')
144
+ caps.browser_version = data.delete('browserVersion') if data.key?('browserVersion')
145
+ caps.platform_name = data.delete('platformName') if data.key?('platformName')
146
+ caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
147
+ caps.page_load_strategy = data.delete('pageLoadStrategy') if data.key?('pageLoadStrategy')
148
+
149
+ if data.key?('timeouts')
150
+ timeouts = data.delete('timeouts')
151
+ caps.implicit_timeout = timeouts['implicit'] if timeouts
152
+ caps.page_load_timeout = timeouts['pageLoad'] if timeouts
153
+ caps.script_timeout = timeouts['script'] if timeouts
154
+ end
155
+
156
+ if data.key?('proxy')
157
+ proxy = data.delete('proxy')
158
+ caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
159
+ end
160
+
161
+ # Remote Server Specific
162
+ caps[:remote_session_id] = data.delete('webdriver.remote.sessionid') if data.key?('webdriver.remote.sessionid')
145
163
 
146
164
  # any remaining pairs will be added as is, with no conversion
147
165
  caps.merge!(data)
@@ -150,25 +168,20 @@ module Selenium
150
168
  end
151
169
  end
152
170
 
153
- # @option :browser_name [String] required browser name
154
- # @option :version [String] required browser version number
155
- # @option :platform [Symbol] one of :any, :win, :mac, or :x
156
- # @option :javascript_enabled [Boolean] does the driver have javascript enabled?
157
- # @option :css_selectors_enabled [Boolean] does the driver support CSS selectors?
158
- # @option :takes_screenshot [Boolean] can this driver take screenshots?
159
- # @option :native_events [Boolean] does this driver use native events?
160
- # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
161
- #
162
- # Firefox-specific options:
163
171
  #
164
- # @option :firefox_profile [Selenium::WebDriver::Firefox::Profile] the firefox profile to use
172
+ # @param [Hash] opts
173
+ # @option :browser_name [String] required browser name
174
+ # @option :browser_version [String] required browser version number
175
+ # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
176
+ # @option :accept_insecure_certs [Boolean] does the driver accept insecure SSL certifications?
177
+ # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
165
178
  #
166
179
  # @api public
167
180
  #
168
181
 
169
182
  def initialize(opts = {})
170
- @capabilities = DEFAULTS.merge(opts)
171
- self.proxy = opts.delete(:proxy)
183
+ @capabilities = opts
184
+ self.proxy = opts.delete(:proxy)
172
185
  end
173
186
 
174
187
  #
@@ -204,6 +217,7 @@ module Selenium
204
217
  end
205
218
  end
206
219
 
220
+ #
207
221
  # @api private
208
222
  #
209
223
 
@@ -214,11 +228,13 @@ module Selenium
214
228
  case key
215
229
  when :platform
216
230
  hash['platform'] = value.to_s.upcase
217
- when :firefox_profile
218
- hash['firefox_profile'] = value.as_json['zip'] if value
219
231
  when :proxy
220
- hash['proxy'] = value.as_json if value
221
- when String, :firefox_binary
232
+ if value
233
+ hash['proxy'] = value.as_json
234
+ hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
235
+ hash['proxy']['noProxy'] = hash['proxy']['noProxy'].split(', ') if hash['proxy']['noProxy'].is_a?(String)
236
+ end
237
+ when String
222
238
  hash[key.to_s] = value
223
239
  when Symbol
224
240
  hash[camel_case(key.to_s)] = value
@@ -236,8 +252,10 @@ module Selenium
236
252
 
237
253
  def ==(other)
238
254
  return false unless other.is_a? self.class
255
+
239
256
  as_json == other.as_json
240
257
  end
258
+
241
259
  alias_method :eql?, :==
242
260
 
243
261
  protected
@@ -249,6 +267,7 @@ module Selenium
249
267
  def camel_case(str)
250
268
  str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
251
269
  end
270
+
252
271
  end # Capabilities
253
272
  end # Remote
254
273
  end # WebDriver
@@ -1,5 +1,5 @@
1
- # encoding: utf-8
2
- #
1
+ # frozen_string_literal: true
2
+
3
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
4
4
  # or more contributor license agreements. See the NOTICE file
5
5
  # distributed with this work for additional information
@@ -20,197 +20,137 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Remote
23
+
24
+ #
25
+ # https://w3c.github.io/webdriver/#endpoints
26
+ # @api private
27
+ #
28
+
23
29
  class Bridge
24
- #
25
- # https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#command-reference
26
- #
27
-
28
- command :newSession, :post, 'session'
29
- command :getCapabilities, :get, 'session/:session_id'
30
- command :status, :get, 'status'
31
-
32
- #
33
- # basic driver
34
- #
35
-
36
- command :getCurrentUrl, :get, 'session/:session_id/url'
37
- command :get, :post, 'session/:session_id/url'
38
- command :goForward, :post, 'session/:session_id/forward'
39
- command :goBack, :post, 'session/:session_id/back'
40
- command :refresh, :post, 'session/:session_id/refresh'
41
- command :quit, :delete, 'session/:session_id'
42
- command :close, :delete, 'session/:session_id/window'
43
- command :getPageSource, :get, 'session/:session_id/source'
44
- command :getTitle, :get, 'session/:session_id/title'
45
- command :findElement, :post, 'session/:session_id/element'
46
- command :findElements, :post, 'session/:session_id/elements'
47
- command :getActiveElement, :post, 'session/:session_id/element/active'
48
-
49
- #
50
- # window handling
51
- #
52
-
53
- command :getCurrentWindowHandle, :get, 'session/:session_id/window_handle'
54
- command :getWindowHandles, :get, 'session/:session_id/window_handles'
55
- command :setWindowSize, :post, 'session/:session_id/window/:window_handle/size'
56
- command :setWindowPosition, :post, 'session/:session_id/window/:window_handle/position'
57
- command :getWindowSize, :get, 'session/:session_id/window/:window_handle/size'
58
- command :getWindowPosition, :get, 'session/:session_id/window/:window_handle/position'
59
- command :maximizeWindow, :post, 'session/:session_id/window/:window_handle/maximize'
60
-
61
- #
62
- # script execution
63
- #
64
-
65
- command :executeScript, :post, 'session/:session_id/execute'
66
- command :executeAsyncScript, :post, 'session/:session_id/execute_async'
67
-
68
- #
69
- # screenshot
70
- #
71
-
72
- command :screenshot, :get, 'session/:session_id/screenshot'
73
-
74
- #
75
- # alerts
76
- #
77
-
78
- command :dismissAlert, :post, 'session/:session_id/dismiss_alert'
79
- command :acceptAlert, :post, 'session/:session_id/accept_alert'
80
- command :getAlertText, :get, 'session/:session_id/alert_text'
81
- command :setAlertValue, :post, 'session/:session_id/alert_text'
82
- command :setAuthentication, :post, 'session/:session_id/alert/credentials'
83
-
84
- #
85
- # target locator
86
- #
87
-
88
- command :switchToFrame, :post, 'session/:session_id/frame'
89
- command :switchToParentFrame, :post, 'session/:session_id/frame/parent'
90
- command :switchToWindow, :post, 'session/:session_id/window'
91
-
92
- #
93
- # options
94
- #
95
-
96
- command :getCookies, :get, 'session/:session_id/cookie'
97
- command :addCookie, :post, 'session/:session_id/cookie'
98
- command :deleteAllCookies, :delete, 'session/:session_id/cookie'
99
- command :deleteCookie, :delete, 'session/:session_id/cookie/:name'
100
-
101
- #
102
- # timeouts
103
- #
104
-
105
- command :implicitlyWait, :post, 'session/:session_id/timeouts/implicit_wait'
106
- command :setScriptTimeout, :post, 'session/:session_id/timeouts/async_script'
107
- command :setTimeout, :post, 'session/:session_id/timeouts'
108
-
109
- #
110
- # element
111
- #
112
-
113
- command :describeElement, :get, 'session/:session_id/element/:id'
114
- command :findChildElement, :post, 'session/:session_id/element/:id/element'
115
- command :findChildElements, :post, 'session/:session_id/element/:id/elements'
116
- command :clickElement, :post, 'session/:session_id/element/:id/click'
117
- command :submitElement, :post, 'session/:session_id/element/:id/submit'
118
- command :getElementValue, :get, 'session/:session_id/element/:id/value'
119
- command :sendKeysToElement, :post, 'session/:session_id/element/:id/value'
120
- command :uploadFile, :post, 'session/:session_id/file'
121
- command :getElementTagName, :get, 'session/:session_id/element/:id/name'
122
- command :clearElement, :post, 'session/:session_id/element/:id/clear'
123
- command :isElementSelected, :get, 'session/:session_id/element/:id/selected'
124
- command :isElementEnabled, :get, 'session/:session_id/element/:id/enabled'
125
- command :getElementAttribute, :get, 'session/:session_id/element/:id/attribute/:name'
126
- command :elementEquals, :get, 'session/:session_id/element/:id/equals/:other'
127
- command :isElementDisplayed, :get, 'session/:session_id/element/:id/displayed'
128
- command :getElementLocation, :get, 'session/:session_id/element/:id/location'
129
- command :getElementLocationOnceScrolledIntoView, :get, 'session/:session_id/element/:id/location_in_view'
130
- command :getElementSize, :get, 'session/:session_id/element/:id/size'
131
- command :dragElement, :post, 'session/:session_id/element/:id/drag'
132
- command :getElementValueOfCssProperty, :get, 'session/:session_id/element/:id/css/:property_name'
133
- command :getElementText, :get, 'session/:session_id/element/:id/text'
134
-
135
- #
136
- # rotatable
137
- #
138
-
139
- command :getScreenOrientation, :get, 'session/:session_id/orientation'
140
- command :setScreenOrientation, :post, 'session/:session_id/orientation'
141
-
142
- #
143
- # interactions API
144
- #
145
-
146
- command :click, :post, 'session/:session_id/click'
147
- command :doubleClick, :post, 'session/:session_id/doubleclick'
148
- command :mouseDown, :post, 'session/:session_id/buttondown'
149
- command :mouseUp, :post, 'session/:session_id/buttonup'
150
- command :mouseMoveTo, :post, 'session/:session_id/moveto'
151
- command :sendModifierKeyToActiveElement, :post, 'session/:session_id/modifier'
152
- command :sendKeysToActiveElement, :post, 'session/:session_id/keys'
153
-
154
- #
155
- # html 5
156
- #
157
-
158
- command :executeSql, :post, 'session/:session_id/execute_sql'
159
-
160
- command :getLocation, :get, 'session/:session_id/location'
161
- command :setLocation, :post, 'session/:session_id/location'
162
-
163
- command :getAppCache, :get, 'session/:session_id/application_cache'
164
- command :getAppCacheStatus, :get, 'session/:session_id/application_cache/status'
165
- command :clearAppCache, :delete, 'session/:session_id/application_cache/clear'
166
-
167
- command :getNetworkConnection, :get, 'session/:session_id/network_connection'
168
- command :setNetworkConnection, :post, 'session/:session_id/network_connection'
169
-
170
- command :getLocalStorageItem, :get, 'session/:session_id/local_storage/key/:key'
171
- command :removeLocalStorageItem, :delete, 'session/:session_id/local_storage/key/:key'
172
- command :getLocalStorageKeys, :get, 'session/:session_id/local_storage'
173
- command :setLocalStorageItem, :post, 'session/:session_id/local_storage'
174
- command :clearLocalStorage, :delete, 'session/:session_id/local_storage'
175
- command :getLocalStorageSize, :get, 'session/:session_id/local_storage/size'
176
-
177
- command :getSessionStorageItem, :get, 'session/:session_id/session_storage/key/:key'
178
- command :removeSessionStorageItem, :delete, 'session/:session_id/session_storage/key/:key'
179
- command :getSessionStorageKeys, :get, 'session/:session_id/session_storage'
180
- command :setSessionStorageItem, :post, 'session/:session_id/session_storage'
181
- command :clearSessionStorage, :delete, 'session/:session_id/session_storage'
182
- command :getSessionStorageSize, :get, 'session/:session_id/session_storage/size'
183
-
184
- #
185
- # ime
186
- #
187
-
188
- command :imeGetAvailableEngines, :get, 'session/:session_id/ime/available_engines'
189
- command :imeGetActiveEngine, :get, 'session/:session_id/ime/active_engine'
190
- command :imeIsActivated, :get, 'session/:session_id/ime/activated'
191
- command :imeDeactivate, :post, 'session/:session_id/ime/deactivate'
192
- command :imeActivateEngine, :post, 'session/:session_id/ime/activate'
193
-
194
- #
195
- # touch
196
- #
197
-
198
- command :touchSingleTap, :post, 'session/:session_id/touch/click'
199
- command :touchDoubleTap, :post, 'session/:session_id/touch/doubleclick'
200
- command :touchLongPress, :post, 'session/:session_id/touch/longclick'
201
- command :touchDown, :post, 'session/:session_id/touch/down'
202
- command :touchUp, :post, 'session/:session_id/touch/up'
203
- command :touchMove, :post, 'session/:session_id/touch/move'
204
- command :touchScroll, :post, 'session/:session_id/touch/scroll'
205
- command :touchFlick, :post, 'session/:session_id/touch/flick'
206
-
207
- #
208
- # logs
209
- #
210
-
211
- command :getAvailableLogTypes, :get, 'session/:session_id/log/types'
212
- command :getLog, :post, 'session/:session_id/log'
213
- end
30
+ COMMANDS = {
31
+ status: [:get, 'status'],
32
+
33
+ #
34
+ # session handling
35
+ #
36
+
37
+ new_session: [:post, 'session'],
38
+ delete_session: [:delete, 'session/:session_id'],
39
+
40
+ #
41
+ # basic driver
42
+ #
43
+
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'],
50
+
51
+ #
52
+ # window and Frame handling
53
+ #
54
+
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'],
71
+
72
+ #
73
+ # element
74
+ #
75
+
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'],
89
+
90
+ #
91
+ # document handling
92
+ #
93
+
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'],
97
+
98
+ #
99
+ # cookies
100
+ #
101
+
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'],
107
+
108
+ #
109
+ # timeouts
110
+ #
111
+
112
+ set_timeout: [:post, 'session/:session_id/timeouts'],
113
+
114
+ #
115
+ # actions
116
+ #
117
+
118
+ actions: [:post, 'session/:session_id/actions'],
119
+ release_actions: [:delete, 'session/:session_id/actions'],
120
+
121
+ #
122
+ # Element Operations
123
+ #
124
+
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'],
129
+
130
+ #
131
+ # alerts
132
+ #
133
+
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'],
138
+
139
+ #
140
+ # screenshot
141
+ #
142
+
143
+ take_screenshot: [:get, 'session/:session_id/screenshot'],
144
+ take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
145
+
146
+ #
147
+ # server extensions
148
+ #
149
+
150
+ upload_file: [:post, 'session/:session_id/se/file']
151
+ }.freeze
152
+
153
+ end # Bridge
214
154
  end # Remote
215
155
  end # WebDriver
216
156
  end # Selenium