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.
Files changed (122) hide show
  1. data/CHANGES +24 -18
  2. data/README.md +2 -3
  3. data/lib/selenium/server.rb +64 -68
  4. data/lib/selenium/webdriver.rb +5 -9
  5. data/lib/selenium/webdriver/chrome.rb +18 -3
  6. data/lib/selenium/webdriver/chrome/bridge.rb +13 -16
  7. data/lib/selenium/webdriver/chrome/profile.rb +7 -9
  8. data/lib/selenium/webdriver/chrome/service.rb +8 -84
  9. data/lib/selenium/webdriver/common.rb +1 -2
  10. data/lib/selenium/webdriver/common/action_builder.rb +28 -38
  11. data/lib/selenium/webdriver/common/alert.rb +7 -10
  12. data/lib/selenium/webdriver/common/bridge_helper.rb +10 -15
  13. data/lib/selenium/webdriver/common/driver.rb +19 -28
  14. data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +0 -3
  15. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +4 -6
  16. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +4 -5
  17. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +0 -2
  18. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +0 -2
  19. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +0 -2
  20. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +0 -3
  21. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -6
  22. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -5
  23. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +2 -5
  24. data/lib/selenium/webdriver/common/element.rb +27 -29
  25. data/lib/selenium/webdriver/common/error.rb +17 -20
  26. data/lib/selenium/webdriver/common/file_reaper.rb +3 -9
  27. data/lib/selenium/webdriver/common/html5/local_storage.rb +6 -8
  28. data/lib/selenium/webdriver/common/html5/session_storage.rb +6 -8
  29. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +6 -15
  30. data/lib/selenium/webdriver/common/keyboard.rb +7 -12
  31. data/lib/selenium/webdriver/common/keys.rb +67 -69
  32. data/lib/selenium/webdriver/common/log_entry.rb +3 -4
  33. data/lib/selenium/webdriver/common/logs.rb +2 -4
  34. data/lib/selenium/webdriver/common/mouse.rb +9 -12
  35. data/lib/selenium/webdriver/common/navigation.rb +2 -4
  36. data/lib/selenium/webdriver/common/options.rb +16 -19
  37. data/lib/selenium/webdriver/common/platform.rb +61 -90
  38. data/lib/selenium/webdriver/common/port_prober.rb +1 -2
  39. data/lib/selenium/webdriver/common/profile_helper.rb +5 -8
  40. data/lib/selenium/webdriver/common/proxy.rb +58 -70
  41. data/lib/selenium/webdriver/common/search_context.rb +15 -19
  42. data/lib/selenium/webdriver/common/service.rb +127 -0
  43. data/lib/selenium/webdriver/common/socket_lock.rb +5 -11
  44. data/lib/selenium/webdriver/common/socket_poller.rb +4 -9
  45. data/lib/selenium/webdriver/common/target_locator.rb +11 -13
  46. data/lib/selenium/webdriver/common/timeouts.rb +4 -6
  47. data/lib/selenium/webdriver/common/touch_action_builder.rb +2 -4
  48. data/lib/selenium/webdriver/common/touch_screen.rb +15 -18
  49. data/lib/selenium/webdriver/common/w3c_error.rb +3 -6
  50. data/lib/selenium/webdriver/common/wait.rb +6 -11
  51. data/lib/selenium/webdriver/common/window.rb +12 -15
  52. data/lib/selenium/webdriver/common/zipper.rb +6 -8
  53. data/lib/selenium/webdriver/edge.rb +18 -3
  54. data/lib/selenium/webdriver/edge/bridge.rb +11 -16
  55. data/lib/selenium/webdriver/edge/legacy_support.rb +38 -39
  56. data/lib/selenium/webdriver/edge/service.rb +8 -82
  57. data/lib/selenium/webdriver/firefox.rb +25 -6
  58. data/lib/selenium/webdriver/firefox/binary.rb +37 -53
  59. data/lib/selenium/webdriver/firefox/bridge.rb +3 -6
  60. data/lib/selenium/webdriver/firefox/extension.rb +4 -6
  61. data/lib/selenium/webdriver/firefox/extension/prefs.json +1 -10
  62. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  63. data/lib/selenium/webdriver/firefox/launcher.rb +8 -11
  64. data/lib/selenium/webdriver/firefox/profile.rb +40 -42
  65. data/lib/selenium/webdriver/firefox/profiles_ini.rb +8 -15
  66. data/lib/selenium/webdriver/firefox/service.rb +23 -79
  67. data/lib/selenium/webdriver/firefox/util.rb +0 -2
  68. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +2 -4
  69. data/lib/selenium/webdriver/ie.rb +16 -7
  70. data/lib/selenium/webdriver/ie/bridge.rb +16 -23
  71. data/lib/selenium/webdriver/{iphone.rb → ie/service.rb} +26 -4
  72. data/lib/selenium/webdriver/phantomjs.rb +8 -3
  73. data/lib/selenium/webdriver/phantomjs/bridge.rb +9 -11
  74. data/lib/selenium/webdriver/phantomjs/service.rb +17 -81
  75. data/lib/selenium/webdriver/remote.rb +0 -2
  76. data/lib/selenium/webdriver/remote/bridge.rb +193 -191
  77. data/lib/selenium/webdriver/remote/capabilities.rb +60 -90
  78. data/lib/selenium/webdriver/remote/commands.rb +197 -192
  79. data/lib/selenium/webdriver/remote/http/common.rb +15 -13
  80. data/lib/selenium/webdriver/remote/http/curb.rb +5 -9
  81. data/lib/selenium/webdriver/remote/http/default.rb +32 -37
  82. data/lib/selenium/webdriver/remote/http/persistent.rb +4 -6
  83. data/lib/selenium/webdriver/remote/response.rb +13 -21
  84. data/lib/selenium/webdriver/remote/server_error.rb +1 -3
  85. data/lib/selenium/webdriver/remote/w3c_bridge.rb +200 -195
  86. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +38 -46
  87. data/lib/selenium/webdriver/remote/w3c_commands.rb +116 -113
  88. data/lib/selenium/webdriver/safari.rb +23 -7
  89. data/lib/selenium/{client/javascript_frameworks/jquery.rb → webdriver/safari/apple_bridge.rb} +28 -9
  90. data/lib/selenium/webdriver/safari/browser.rb +0 -2
  91. data/lib/selenium/webdriver/safari/{bridge.rb → legacy_bridge.rb} +12 -9
  92. data/lib/selenium/webdriver/safari/options.rb +3 -4
  93. data/lib/selenium/webdriver/safari/resources/client.js +56 -7255
  94. data/lib/selenium/webdriver/safari/server.rb +18 -24
  95. data/lib/selenium/{client/javascript_frameworks/prototype.rb → webdriver/safari/service.rb} +27 -9
  96. data/lib/selenium/webdriver/support.rb +1 -0
  97. data/lib/selenium/webdriver/support/abstract_event_listener.rb +17 -2
  98. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -3
  99. data/lib/selenium/webdriver/support/color.rb +55 -38
  100. data/lib/selenium/webdriver/{android.rb → support/escaper.rb} +19 -4
  101. data/lib/selenium/webdriver/support/event_firing_bridge.rb +36 -38
  102. data/lib/selenium/webdriver/support/select.rb +33 -84
  103. data/selenium-webdriver.gemspec +23 -23
  104. metadata +19 -30
  105. data/lib/selenium-client.rb +0 -21
  106. data/lib/selenium/client.rb +0 -57
  107. data/lib/selenium/client/base.rb +0 -151
  108. data/lib/selenium/client/driver.rb +0 -29
  109. data/lib/selenium/client/errors.rb +0 -28
  110. data/lib/selenium/client/extensions.rb +0 -132
  111. data/lib/selenium/client/idiomatic.rb +0 -507
  112. data/lib/selenium/client/javascript_expression_builder.rb +0 -135
  113. data/lib/selenium/client/legacy_driver.rb +0 -1722
  114. data/lib/selenium/client/protocol.rb +0 -123
  115. data/lib/selenium/client/selenium_helper.rb +0 -49
  116. data/lib/selenium/rake/server_task.rb +0 -176
  117. data/lib/selenium/webdriver/android/bridge.rb +0 -68
  118. data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
  119. data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
  120. data/lib/selenium/webdriver/common/html5/location.rb +0 -19
  121. data/lib/selenium/webdriver/ie/server.rb +0 -133
  122. data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
@@ -25,19 +25,18 @@ module Selenium
25
25
  # server is being asked to create.
26
26
  #
27
27
  class Capabilities
28
-
29
28
  DEFAULTS = {
30
- :browser_name => "",
31
- :version => "",
32
- :platform => :any,
33
- :javascript_enabled => false,
34
- :css_selectors_enabled => false,
35
- :takes_screenshot => false,
36
- :native_events => false,
37
- :rotatable => false,
38
- :firefox_profile => nil,
39
- :proxy => nil
40
- }
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
41
40
 
42
41
  DEFAULTS.each_key do |key|
43
42
  define_method key do
@@ -50,34 +49,24 @@ module Selenium
50
49
  end
51
50
 
52
51
  alias_method :css_selectors_enabled?, :css_selectors_enabled
53
- alias_method :javascript_enabled? , :javascript_enabled
54
- alias_method :native_events? , :native_events
55
- alias_method :takes_screenshot? , :takes_screenshot
56
- alias_method :rotatable? , :rotatable
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
57
56
 
58
57
  #
59
58
  # Convenience methods for the common choices.
60
59
  #
61
60
 
62
61
  class << self
63
- def android(opts = {})
64
- new({
65
- :browser_name => "android",
66
- :platform => :android,
67
- :javascript_enabled => true,
68
- :rotatable => true,
69
- :takes_screenshot => true
70
- }.merge(opts))
71
- end
72
-
73
62
  def chrome(opts = {})
74
63
  new({
75
- :browser_name => "chrome",
76
- :javascript_enabled => true,
77
- :css_selectors_enabled => true,
78
- :loggingPrefs => {:browser => "ALL",
79
- :driver => "ALL"}
80
- }.merge(opts))
64
+ browser_name: 'chrome',
65
+ javascript_enabled: true,
66
+ css_selectors_enabled: true,
67
+ loggingPrefs: {browser: 'ALL',
68
+ driver: 'ALL'}
69
+ }.merge(opts))
81
70
  end
82
71
 
83
72
  def edge(opts = {})
@@ -85,72 +74,56 @@ module Selenium
85
74
  end
86
75
 
87
76
  def firefox(opts = {})
88
- return W3CCapabilities.firefox(opts) if opts[:marionette]
77
+ return W3CCapabilities.firefox(opts) unless opts[:marionette] == false
89
78
 
90
79
  new({
91
- :browser_name => "firefox",
92
- :javascript_enabled => true,
93
- :takes_screenshot => true,
94
- :css_selectors_enabled => true
80
+ browser_name: 'firefox',
81
+ javascript_enabled: true,
82
+ takes_screenshot: true,
83
+ css_selectors_enabled: true
95
84
  }.merge(opts))
96
85
  end
97
86
 
98
87
  def htmlunit(opts = {})
99
88
  new({
100
- :browser_name => "htmlunit"
89
+ browser_name: 'htmlunit'
101
90
  }.merge(opts))
102
91
  end
103
92
 
104
93
  def htmlunitwithjs(opts = {})
105
94
  new({
106
- :browser_name => "htmlunit",
107
- :javascript_enabled => true
95
+ browser_name: 'htmlunit',
96
+ javascript_enabled: true
108
97
  }.merge(opts))
109
98
  end
110
99
 
111
100
  def internet_explorer(opts = {})
112
101
  new({
113
- :browser_name => "internet explorer",
114
- :platform => :windows,
115
- :takes_screenshot => true,
116
- :css_selectors_enabled => true,
117
- :native_events => true
102
+ browser_name: 'internet explorer',
103
+ platform: :windows,
104
+ takes_screenshot: true,
105
+ css_selectors_enabled: true,
106
+ native_events: true
118
107
  }.merge(opts))
119
108
  end
120
109
  alias_method :ie, :internet_explorer
121
110
 
122
- def iphone(opts = {})
123
- new({
124
- :browser_name => "iPhone",
125
- :platform => :mac,
126
- :javascript_enabled => true
127
- }.merge(opts))
128
- end
129
-
130
- def ipad(opts = {})
131
- new({
132
- :browser_name => "iPad",
133
- :platform => :mac,
134
- :javascript_enabled => true
135
- }.merge(opts))
136
- end
137
-
138
111
  def phantomjs(opts = {})
139
112
  new({
140
- :browser_name => "phantomjs",
141
- :javascript_enabled => true,
142
- :takes_screenshot => true,
143
- :css_selectors_enabled => true
113
+ browser_name: 'phantomjs',
114
+ javascript_enabled: true,
115
+ takes_screenshot: true,
116
+ css_selectors_enabled: true
144
117
  }.merge(opts))
145
118
  end
146
119
 
147
120
  def safari(opts = {})
148
121
  new({
149
- :browser_name => "safari",
150
- :platform => :mac,
151
- :javascript_enabled => true,
152
- :takes_screenshot => true,
153
- :css_selectors_enabled => true
122
+ browser_name: 'safari',
123
+ platform: :mac,
124
+ javascript_enabled: true,
125
+ takes_screenshot: true,
126
+ css_selectors_enabled: true
154
127
  }.merge(opts))
155
128
  end
156
129
 
@@ -162,15 +135,15 @@ module Selenium
162
135
  data = data.dup
163
136
 
164
137
  caps = new
165
- caps.browser_name = data.delete("browserName")
166
- caps.version = data.delete("version")
167
- caps.platform = data.delete("platform").downcase.to_sym if data.has_key?('platform')
168
- caps.javascript_enabled = data.delete("javascriptEnabled")
169
- caps.css_selectors_enabled = data.delete("cssSelectorsEnabled")
170
- caps.takes_screenshot = data.delete("takesScreenshot")
171
- caps.native_events = data.delete("nativeEvents")
172
- caps.rotatable = data.delete("rotatable")
173
- caps.proxy = Proxy.json_create(data['proxy']) if data.has_key?('proxy')
138
+ caps.browser_name = data.delete('browserName')
139
+ caps.version = data.delete('version')
140
+ caps.platform = data.delete('platform').downcase.to_sym if data.key?('platform')
141
+ caps.javascript_enabled = data.delete('javascriptEnabled')
142
+ caps.css_selectors_enabled = data.delete('cssSelectorsEnabled')
143
+ caps.takes_screenshot = data.delete('takesScreenshot')
144
+ caps.native_events = data.delete('nativeEvents')
145
+ caps.rotatable = data.delete('rotatable')
146
+ caps.proxy = Proxy.json_create(data['proxy']) if data.key?('proxy')
174
147
 
175
148
  # any remaining pairs will be added as is, with no conversion
176
149
  caps.merge!(data)
@@ -213,12 +186,12 @@ module Selenium
213
186
  end
214
187
 
215
188
  def merge!(other)
216
- if other.respond_to?(:capabilities, true) && other.capabilities.kind_of?(Hash)
189
+ if other.respond_to?(:capabilities, true) && other.capabilities.is_a?(Hash)
217
190
  @capabilities.merge! other.capabilities
218
- elsif other.kind_of? Hash
191
+ elsif other.is_a? Hash
219
192
  @capabilities.merge! other
220
193
  else
221
- raise ArgumentError, "argument should be a Hash or implement #capabilities"
194
+ raise ArgumentError, 'argument should be a Hash or implement #capabilities'
222
195
  end
223
196
  end
224
197
 
@@ -236,7 +209,7 @@ module Selenium
236
209
  # @api private
237
210
  #
238
211
 
239
- def as_json(opts = nil)
212
+ def as_json(*)
240
213
  hash = {}
241
214
 
242
215
  @capabilities.each do |key, value|
@@ -259,28 +232,25 @@ module Selenium
259
232
  hash
260
233
  end
261
234
 
262
- def to_json(*args)
235
+ def to_json(*)
263
236
  JSON.generate as_json
264
237
  end
265
238
 
266
239
  def ==(other)
267
- return false unless other.kind_of? self.class
240
+ return false unless other.is_a? self.class
268
241
  as_json == other.as_json
269
242
  end
270
243
  alias_method :eql?, :==
271
244
 
272
245
  protected
273
246
 
274
- def capabilities
275
- @capabilities
276
- end
247
+ attr_reader :capabilities
277
248
 
278
249
  private
279
250
 
280
251
  def camel_case(str)
281
- str.gsub(/_([a-z])/) { $1.upcase }
252
+ str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
282
253
  end
283
-
284
254
  end # Capabilities
285
255
  end # Remote
286
256
  end # WebDriver
@@ -17,195 +17,200 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- class Selenium::WebDriver::Remote::Bridge
21
-
22
- #
23
- # https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#command-reference
24
- #
25
-
26
- command :newSession, :post, "session"
27
- command :getCapabilities, :get, "session/:session_id"
28
- command :status, :get, "status"
29
-
30
- #
31
- # basic driver
32
- #
33
-
34
- command :getCurrentUrl, :get, "session/:session_id/url"
35
- command :get, :post, "session/:session_id/url"
36
- command :goForward, :post, "session/:session_id/forward"
37
- command :goBack, :post, "session/:session_id/back"
38
- command :refresh, :post, "session/:session_id/refresh"
39
- command :quit, :delete, "session/:session_id"
40
- command :close, :delete, "session/:session_id/window"
41
- command :getPageSource, :get, "session/:session_id/source"
42
- command :getTitle, :get, "session/:session_id/title"
43
- command :findElement, :post, "session/:session_id/element"
44
- command :findElements, :post, "session/:session_id/elements"
45
- command :getActiveElement, :post, "session/:session_id/element/active"
46
-
47
- #
48
- # window handling
49
- #
50
-
51
- command :getCurrentWindowHandle, :get, "session/:session_id/window_handle"
52
- command :getWindowHandles, :get, "session/:session_id/window_handles"
53
- command :setWindowSize, :post, "session/:session_id/window/:window_handle/size"
54
- command :setWindowPosition, :post, "session/:session_id/window/:window_handle/position"
55
- command :getWindowSize, :get, "session/:session_id/window/:window_handle/size"
56
- command :getWindowPosition, :get, "session/:session_id/window/:window_handle/position"
57
- command :maximizeWindow, :post, "session/:session_id/window/:window_handle/maximize"
58
-
59
- #
60
- # script execution
61
- #
62
-
63
- command :executeScript, :post, "session/:session_id/execute"
64
- command :executeAsyncScript, :post, "session/:session_id/execute_async"
65
-
66
- #
67
- # screenshot
68
- #
69
-
70
- command :screenshot, :get, "session/:session_id/screenshot"
71
-
72
- #
73
- # alerts
74
- #
75
-
76
- command :dismissAlert, :post, "session/:session_id/dismiss_alert"
77
- command :acceptAlert, :post, "session/:session_id/accept_alert"
78
- command :getAlertText, :get, "session/:session_id/alert_text"
79
- command :setAlertValue, :post, "session/:session_id/alert_text"
80
- command :setAuthentication, :post, "session/:session_id/alert/credentials"
81
-
82
- #
83
- # target locator
84
- #
85
-
86
- command :switchToFrame, :post, "session/:session_id/frame"
87
- command :switchToParentFrame, :post, "session/:session_id/frame/parent"
88
- command :switchToWindow, :post, "session/:session_id/window"
89
-
90
- #
91
- # options
92
- #
93
-
94
- command :getCookies, :get, "session/:session_id/cookie"
95
- command :addCookie, :post, "session/:session_id/cookie"
96
- command :deleteAllCookies, :delete, "session/:session_id/cookie"
97
- command :deleteCookie, :delete, "session/:session_id/cookie/:name"
98
-
99
- #
100
- # timeouts
101
- #
102
-
103
- command :implicitlyWait, :post, "session/:session_id/timeouts/implicit_wait"
104
- command :setScriptTimeout, :post, "session/:session_id/timeouts/async_script"
105
- command :setTimeout, :post, "session/:session_id/timeouts"
106
-
107
- #
108
- # element
109
- #
110
-
111
- command :describeElement, :get, "session/:session_id/element/:id"
112
- command :findChildElement, :post, "session/:session_id/element/:id/element"
113
- command :findChildElements, :post, "session/:session_id/element/:id/elements"
114
- command :clickElement, :post, "session/:session_id/element/:id/click"
115
- command :submitElement, :post, "session/:session_id/element/:id/submit"
116
- command :getElementValue, :get, "session/:session_id/element/:id/value"
117
- command :sendKeysToElement, :post, "session/:session_id/element/:id/value"
118
- command :uploadFile, :post, "session/:session_id/file"
119
- command :getElementTagName, :get, "session/:session_id/element/:id/name"
120
- command :clearElement, :post, "session/:session_id/element/:id/clear"
121
- command :isElementSelected, :get, "session/:session_id/element/:id/selected"
122
- command :isElementEnabled, :get, "session/:session_id/element/:id/enabled"
123
- command :getElementAttribute, :get, "session/:session_id/element/:id/attribute/:name"
124
- command :elementEquals, :get, "session/:session_id/element/:id/equals/:other"
125
- command :isElementDisplayed, :get, "session/:session_id/element/:id/displayed"
126
- command :getElementLocation, :get, "session/:session_id/element/:id/location"
127
- command :getElementLocationOnceScrolledIntoView, :get, "session/:session_id/element/:id/location_in_view"
128
- command :getElementSize, :get, "session/:session_id/element/:id/size"
129
- command :dragElement, :post, "session/:session_id/element/:id/drag"
130
- command :getElementValueOfCssProperty, :get, "session/:session_id/element/:id/css/:property_name"
131
- command :getElementText, :get, "session/:session_id/element/:id/text"
132
-
133
- #
134
- # rotatable
135
- #
136
-
137
- command :getScreenOrientation, :get, "session/:session_id/orientation"
138
- command :setScreenOrientation, :post, "session/:session_id/orientation"
139
-
140
- #
141
- # interactions API
142
- #
143
-
144
- command :click, :post, "session/:session_id/click"
145
- command :doubleClick, :post, "session/:session_id/doubleclick"
146
- command :mouseDown, :post, "session/:session_id/buttondown"
147
- command :mouseUp, :post, "session/:session_id/buttonup"
148
- command :mouseMoveTo, :post, "session/:session_id/moveto"
149
- command :sendModifierKeyToActiveElement, :post, "session/:session_id/modifier"
150
- command :sendKeysToActiveElement, :post, "session/:session_id/keys"
151
-
152
- #
153
- # html 5
154
- #
155
-
156
- command :executeSql, :post, "session/:session_id/execute_sql"
157
-
158
- command :getLocation, :get, "session/:session_id/location"
159
- command :setLocation, :post, "session/:session_id/location"
160
-
161
- command :getAppCache, :get, "session/:session_id/application_cache"
162
- command :getAppCacheStatus, :get, "session/:session_id/application_cache/status"
163
- command :clearAppCache, :delete, "session/:session_id/application_cache/clear"
164
-
165
- command :getNetworkConnection, :get, "session/:session_id/network_connection"
166
- command :setNetworkConnection, :post, "session/:session_id/network_connection"
167
-
168
- command :getLocalStorageItem, :get, "session/:session_id/local_storage/key/:key"
169
- command :removeLocalStorageItem, :delete, "session/:session_id/local_storage/key/:key"
170
- command :getLocalStorageKeys, :get, "session/:session_id/local_storage"
171
- command :setLocalStorageItem, :post, "session/:session_id/local_storage"
172
- command :clearLocalStorage, :delete, "session/:session_id/local_storage"
173
- command :getLocalStorageSize, :get, "session/:session_id/local_storage/size"
174
-
175
- command :getSessionStorageItem, :get, "session/:session_id/session_storage/key/:key"
176
- command :removeSessionStorageItem, :delete, "session/:session_id/session_storage/key/:key"
177
- command :getSessionStorageKeys, :get, "session/:session_id/session_storage"
178
- command :setSessionStorageItem, :post, "session/:session_id/session_storage"
179
- command :clearSessionStorage, :delete, "session/:session_id/session_storage"
180
- command :getSessionStorageSize, :get, "session/:session_id/session_storage/size"
181
-
182
- #
183
- # ime
184
- #
185
-
186
- command :imeGetAvailableEngines, :get, "session/:session_id/ime/available_engines"
187
- command :imeGetActiveEngine, :get, "session/:session_id/ime/active_engine"
188
- command :imeIsActivated, :get, "session/:session_id/ime/activated"
189
- command :imeDeactivate, :post, "session/:session_id/ime/deactivate"
190
- command :imeActivateEngine, :post, "session/:session_id/ime/activate"
191
-
192
- #
193
- # touch
194
- #
195
-
196
- command :touchSingleTap, :post, "session/:session_id/touch/click"
197
- command :touchDoubleTap, :post, "session/:session_id/touch/doubleclick"
198
- command :touchLongPress, :post, "session/:session_id/touch/longclick"
199
- command :touchDown, :post, "session/:session_id/touch/down"
200
- command :touchUp, :post, "session/:session_id/touch/up"
201
- command :touchMove, :post, "session/:session_id/touch/move"
202
- command :touchScroll, :post, "session/:session_id/touch/scroll"
203
- command :touchFlick, :post, "session/:session_id/touch/flick"
204
-
205
- #
206
- # logs
207
- #
208
-
209
- command :getAvailableLogTypes, :get, "session/:session_id/log/types"
210
- command :getLog, :post, "session/:session_id/log"
211
- end
20
+ module Selenium
21
+ module WebDriver
22
+ module Remote
23
+ 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
214
+ end # Remote
215
+ end # WebDriver
216
+ end # Selenium