browserstack-webdriver 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +791 -0
- data/README.md +31 -0
- data/build.desc +334 -0
- data/lib/selenium-client.rb +2 -0
- data/lib/selenium-webdriver.rb +1 -0
- data/lib/selenium/client.rb +37 -0
- data/lib/selenium/client/base.rb +132 -0
- data/lib/selenium/client/driver.rb +10 -0
- data/lib/selenium/client/errors.rb +9 -0
- data/lib/selenium/client/extensions.rb +118 -0
- data/lib/selenium/client/idiomatic.rb +488 -0
- data/lib/selenium/client/javascript_expression_builder.rb +116 -0
- data/lib/selenium/client/javascript_frameworks/jquery.rb +13 -0
- data/lib/selenium/client/javascript_frameworks/prototype.rb +13 -0
- data/lib/selenium/client/legacy_driver.rb +1720 -0
- data/lib/selenium/client/protocol.rb +104 -0
- data/lib/selenium/client/selenium_helper.rb +34 -0
- data/lib/selenium/rake/server_task.rb +157 -0
- data/lib/selenium/server.rb +248 -0
- data/lib/selenium/webdriver.rb +71 -0
- data/lib/selenium/webdriver/android.rb +9 -0
- data/lib/selenium/webdriver/android/bridge.rb +47 -0
- data/lib/selenium/webdriver/chrome.rb +26 -0
- data/lib/selenium/webdriver/chrome/bridge.rb +120 -0
- data/lib/selenium/webdriver/chrome/profile.rb +90 -0
- data/lib/selenium/webdriver/chrome/service.rb +75 -0
- data/lib/selenium/webdriver/common.rb +44 -0
- data/lib/selenium/webdriver/common/action_builder.rb +352 -0
- data/lib/selenium/webdriver/common/alert.rb +30 -0
- data/lib/selenium/webdriver/common/bridge_helper.rb +67 -0
- data/lib/selenium/webdriver/common/core_ext/base64.rb +9 -0
- data/lib/selenium/webdriver/common/core_ext/dir.rb +42 -0
- data/lib/selenium/webdriver/common/core_ext/string.rb +5 -0
- data/lib/selenium/webdriver/common/driver.rb +301 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_browser_connection.rb +17 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +39 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +25 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +13 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +22 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +19 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +22 -0
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +43 -0
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +46 -0
- data/lib/selenium/webdriver/common/element.rb +293 -0
- data/lib/selenium/webdriver/common/error.rb +207 -0
- data/lib/selenium/webdriver/common/file_reaper.rb +47 -0
- data/lib/selenium/webdriver/common/html5/local_storage.rb +42 -0
- data/lib/selenium/webdriver/common/html5/location.rb +0 -0
- data/lib/selenium/webdriver/common/html5/session_storage.rb +44 -0
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +42 -0
- data/lib/selenium/webdriver/common/json_helper.rb +34 -0
- data/lib/selenium/webdriver/common/keyboard.rb +55 -0
- data/lib/selenium/webdriver/common/keys.rb +109 -0
- data/lib/selenium/webdriver/common/log_entry.rb +29 -0
- data/lib/selenium/webdriver/common/logs.rb +23 -0
- data/lib/selenium/webdriver/common/mouse.rb +72 -0
- data/lib/selenium/webdriver/common/navigation.rb +43 -0
- data/lib/selenium/webdriver/common/options.rb +136 -0
- data/lib/selenium/webdriver/common/platform.rb +218 -0
- data/lib/selenium/webdriver/common/port_prober.rb +42 -0
- data/lib/selenium/webdriver/common/profile_helper.rb +67 -0
- data/lib/selenium/webdriver/common/proxy.rb +149 -0
- data/lib/selenium/webdriver/common/search_context.rb +92 -0
- data/lib/selenium/webdriver/common/socket_poller.rb +105 -0
- data/lib/selenium/webdriver/common/target_locator.rb +81 -0
- data/lib/selenium/webdriver/common/timeouts.rb +38 -0
- data/lib/selenium/webdriver/common/touch_action_builder.rb +64 -0
- data/lib/selenium/webdriver/common/touch_screen.rb +105 -0
- data/lib/selenium/webdriver/common/wait.rb +63 -0
- data/lib/selenium/webdriver/common/window.rb +104 -0
- data/lib/selenium/webdriver/common/zipper.rb +82 -0
- data/lib/selenium/webdriver/firefox.rb +37 -0
- data/lib/selenium/webdriver/firefox/binary.rb +158 -0
- data/lib/selenium/webdriver/firefox/bridge.rb +70 -0
- data/lib/selenium/webdriver/firefox/extension.rb +52 -0
- data/lib/selenium/webdriver/firefox/launcher.rb +106 -0
- data/lib/selenium/webdriver/firefox/profile.rb +263 -0
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +62 -0
- data/lib/selenium/webdriver/firefox/socket_lock.rb +61 -0
- data/lib/selenium/webdriver/firefox/util.rb +29 -0
- data/lib/selenium/webdriver/ie.rb +19 -0
- data/lib/selenium/webdriver/ie/bridge.rb +68 -0
- data/lib/selenium/webdriver/ie/server.rb +86 -0
- data/lib/selenium/webdriver/iphone.rb +9 -0
- data/lib/selenium/webdriver/iphone/bridge.rb +45 -0
- data/lib/selenium/webdriver/opera.rb +24 -0
- data/lib/selenium/webdriver/opera/bridge.rb +112 -0
- data/lib/selenium/webdriver/opera/service.rb +49 -0
- data/lib/selenium/webdriver/phantomjs.rb +22 -0
- data/lib/selenium/webdriver/phantomjs/bridge.rb +59 -0
- data/lib/selenium/webdriver/phantomjs/service.rb +90 -0
- data/lib/selenium/webdriver/remote.rb +22 -0
- data/lib/selenium/webdriver/remote/bridge.rb +644 -0
- data/lib/selenium/webdriver/remote/capabilities.rb +267 -0
- data/lib/selenium/webdriver/remote/commands.rb +193 -0
- data/lib/selenium/webdriver/remote/http/common.rb +74 -0
- data/lib/selenium/webdriver/remote/http/curb.rb +79 -0
- data/lib/selenium/webdriver/remote/http/default.rb +139 -0
- data/lib/selenium/webdriver/remote/http/persistent.rb +38 -0
- data/lib/selenium/webdriver/remote/response.rb +97 -0
- data/lib/selenium/webdriver/remote/server_error.rb +17 -0
- data/lib/selenium/webdriver/safari.rb +46 -0
- data/lib/selenium/webdriver/safari/bridge.rb +110 -0
- data/lib/selenium/webdriver/safari/browser.rb +20 -0
- data/lib/selenium/webdriver/safari/extension.rb +120 -0
- data/lib/selenium/webdriver/safari/server.rb +145 -0
- data/lib/selenium/webdriver/support.rb +5 -0
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +28 -0
- data/lib/selenium/webdriver/support/block_event_listener.rb +17 -0
- data/lib/selenium/webdriver/support/color.rb +110 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +112 -0
- data/lib/selenium/webdriver/support/select.rb +293 -0
- data/ruby.iml +13 -0
- data/spec/integration/selenium/client/api/backward_compatible_api_spec.rb +22 -0
- data/spec/integration/selenium/client/api/browser_xpath_library_spec.rb +17 -0
- data/spec/integration/selenium/client/api/click_spec.rb +39 -0
- data/spec/integration/selenium/client/api/cookie_spec.rb +39 -0
- data/spec/integration/selenium/client/api/element_spec.rb +14 -0
- data/spec/integration/selenium/client/api/highlight_located_element_spec.rb +19 -0
- data/spec/integration/selenium/client/api/retrieve_last_remote_control_logs_spec.rb +33 -0
- data/spec/integration/selenium/client/api/screenshot_spec.rb +31 -0
- data/spec/integration/selenium/client/api/select_window_spec.rb +46 -0
- data/spec/integration/selenium/client/api/start_stop_spec.rb +9 -0
- data/spec/integration/selenium/client/api/wait_for_ajax_spec.rb +27 -0
- data/spec/integration/selenium/client/api/wait_for_element_spec.rb +56 -0
- data/spec/integration/selenium/client/api/wait_for_field_value_spec.rb +52 -0
- data/spec/integration/selenium/client/api/wait_for_text_spec.rb +98 -0
- data/spec/integration/selenium/client/api/webdriver_backed_spec.rb +21 -0
- data/spec/integration/selenium/client/sample-app/public/jquery-1.3.2.js +4376 -0
- data/spec/integration/selenium/client/sample-app/public/jquery.html +55 -0
- data/spec/integration/selenium/client/sample-app/public/prototype-1.6.0.3.js +4320 -0
- data/spec/integration/selenium/client/sample-app/public/prototype.html +59 -0
- data/spec/integration/selenium/client/sample-app/sample_app.rb +32 -0
- data/spec/integration/selenium/client/spec_helper.rb +139 -0
- data/spec/integration/selenium/webdriver/app_cache_spec.rb +47 -0
- data/spec/integration/selenium/webdriver/browser_connection_spec.rb +20 -0
- data/spec/integration/selenium/webdriver/chrome/driver_spec.rb +28 -0
- data/spec/integration/selenium/webdriver/chrome/profile_spec.rb +63 -0
- data/spec/integration/selenium/webdriver/driver_spec.rb +266 -0
- data/spec/integration/selenium/webdriver/element_spec.rb +191 -0
- data/spec/integration/selenium/webdriver/error_spec.rb +30 -0
- data/spec/integration/selenium/webdriver/firefox/driver_spec.rb +21 -0
- data/spec/integration/selenium/webdriver/firefox/profile_spec.rb +141 -0
- data/spec/integration/selenium/webdriver/keyboard_spec.rb +57 -0
- data/spec/integration/selenium/webdriver/location_spec.rb +29 -0
- data/spec/integration/selenium/webdriver/mouse_spec.rb +57 -0
- data/spec/integration/selenium/webdriver/navigation_spec.rb +46 -0
- data/spec/integration/selenium/webdriver/opera/driver_spec.rb +47 -0
- data/spec/integration/selenium/webdriver/options_spec.rb +77 -0
- data/spec/integration/selenium/webdriver/remote/driver_spec.rb +19 -0
- data/spec/integration/selenium/webdriver/remote/element_spec.rb +26 -0
- data/spec/integration/selenium/webdriver/spec_helper.rb +36 -0
- data/spec/integration/selenium/webdriver/spec_support.rb +12 -0
- data/spec/integration/selenium/webdriver/spec_support/guards.rb +110 -0
- data/spec/integration/selenium/webdriver/spec_support/helpers.rb +51 -0
- data/spec/integration/selenium/webdriver/spec_support/rack_server.rb +123 -0
- data/spec/integration/selenium/webdriver/spec_support/test_environment.rb +239 -0
- data/spec/integration/selenium/webdriver/sql_database_spec.rb +59 -0
- data/spec/integration/selenium/webdriver/storage_spec.rb +96 -0
- data/spec/integration/selenium/webdriver/target_locator_spec.rb +186 -0
- data/spec/integration/selenium/webdriver/timeout_spec.rb +69 -0
- data/spec/integration/selenium/webdriver/touch_spec.rb +176 -0
- data/spec/integration/selenium/webdriver/window_spec.rb +70 -0
- data/spec/integration/selenium/webdriver/zipper_spec.rb +66 -0
- data/spec/unit/selenium/client/base_spec.rb +239 -0
- data/spec/unit/selenium/client/extensions_spec.rb +174 -0
- data/spec/unit/selenium/client/idiomatic_spec.rb +500 -0
- data/spec/unit/selenium/client/javascript_expression_builder_spec.rb +79 -0
- data/spec/unit/selenium/client/javascript_frameworks/jquery_spec.rb +10 -0
- data/spec/unit/selenium/client/javascript_frameworks/prototype_spec.rb +10 -0
- data/spec/unit/selenium/client/protocol_spec.rb +124 -0
- data/spec/unit/selenium/client/selenium_helper_spec.rb +56 -0
- data/spec/unit/selenium/client/spec_helper.rb +24 -0
- data/spec/unit/selenium/rake/task_spec.rb +79 -0
- data/spec/unit/selenium/server_spec.rb +150 -0
- data/spec/unit/selenium/webdriver/action_builder_spec.rb +97 -0
- data/spec/unit/selenium/webdriver/android/bridge_spec.rb +43 -0
- data/spec/unit/selenium/webdriver/chrome/bridge_spec.rb +137 -0
- data/spec/unit/selenium/webdriver/chrome/profile_spec.rb +57 -0
- data/spec/unit/selenium/webdriver/chrome/service_spec.rb +44 -0
- data/spec/unit/selenium/webdriver/error_spec.rb +41 -0
- data/spec/unit/selenium/webdriver/firefox/bridge_spec.rb +47 -0
- data/spec/unit/selenium/webdriver/ie/bridge_spec.rb +91 -0
- data/spec/unit/selenium/webdriver/iphone/bridge_spec.rb +42 -0
- data/spec/unit/selenium/webdriver/log_entry_spec.rb +11 -0
- data/spec/unit/selenium/webdriver/opera/bridge_spec.rb +44 -0
- data/spec/unit/selenium/webdriver/phantomjs/bridge_spec.rb +55 -0
- data/spec/unit/selenium/webdriver/proxy_spec.rb +106 -0
- data/spec/unit/selenium/webdriver/remote/bridge_spec.rb +16 -0
- data/spec/unit/selenium/webdriver/remote/capabilities_spec.rb +115 -0
- data/spec/unit/selenium/webdriver/remote/http/common_spec.rb +24 -0
- data/spec/unit/selenium/webdriver/remote/http/default_spec.rb +124 -0
- data/spec/unit/selenium/webdriver/search_context_spec.rb +61 -0
- data/spec/unit/selenium/webdriver/socket_poller_spec.rb +68 -0
- data/spec/unit/selenium/webdriver/spec_helper.rb +27 -0
- data/spec/unit/selenium/webdriver/support/color_spec.rb +119 -0
- data/spec/unit/selenium/webdriver/support/event_firing_spec.rb +111 -0
- data/spec/unit/selenium/webdriver/support/select_spec.rb +290 -0
- data/spec/unit/selenium/webdriver/wait_spec.rb +49 -0
- metadata +370 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
module Selenium
|
2
|
+
module WebDriver
|
3
|
+
module Remote
|
4
|
+
#
|
5
|
+
# Specification of the desired and/or actual capabilities of the browser that the
|
6
|
+
# server is being asked to create.
|
7
|
+
#
|
8
|
+
class Capabilities
|
9
|
+
|
10
|
+
DEFAULTS = {
|
11
|
+
:browser_name => "",
|
12
|
+
:version => "",
|
13
|
+
:platform => :any,
|
14
|
+
:javascript_enabled => false,
|
15
|
+
:css_selectors_enabled => false,
|
16
|
+
:takes_screenshot => false,
|
17
|
+
:native_events => false,
|
18
|
+
:rotatable => false,
|
19
|
+
:firefox_profile => nil,
|
20
|
+
:proxy => nil
|
21
|
+
}
|
22
|
+
|
23
|
+
DEFAULTS.each_key do |key|
|
24
|
+
define_method key do
|
25
|
+
@capabilities.fetch(key)
|
26
|
+
end
|
27
|
+
|
28
|
+
define_method "#{key}=" do |value|
|
29
|
+
@capabilities[key] = value
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :css_selectors_enabled?, :css_selectors_enabled
|
34
|
+
alias_method :javascript_enabled? , :javascript_enabled
|
35
|
+
alias_method :native_events? , :native_events
|
36
|
+
alias_method :takes_screenshot? , :takes_screenshot
|
37
|
+
alias_method :rotatable? , :rotatable
|
38
|
+
|
39
|
+
#
|
40
|
+
# Convenience methods for the common choices.
|
41
|
+
#
|
42
|
+
|
43
|
+
class << self
|
44
|
+
def android(opts = {})
|
45
|
+
new({
|
46
|
+
:browser_name => "android",
|
47
|
+
:platform => :android,
|
48
|
+
:rotatable => true,
|
49
|
+
:takes_screenshot => true
|
50
|
+
}.merge(opts))
|
51
|
+
end
|
52
|
+
|
53
|
+
def chrome(opts = {})
|
54
|
+
new({
|
55
|
+
:browser_name => "chrome",
|
56
|
+
:javascript_enabled => true,
|
57
|
+
:css_selectors_enabled => true
|
58
|
+
}.merge(opts))
|
59
|
+
end
|
60
|
+
|
61
|
+
def firefox(opts = {})
|
62
|
+
new({
|
63
|
+
:browser_name => "firefox",
|
64
|
+
:javascript_enabled => true,
|
65
|
+
:takes_screenshot => true,
|
66
|
+
:css_selectors_enabled => true
|
67
|
+
}.merge(opts))
|
68
|
+
end
|
69
|
+
|
70
|
+
def htmlunit(opts = {})
|
71
|
+
new({
|
72
|
+
:browser_name => "htmlunit"
|
73
|
+
}.merge(opts))
|
74
|
+
end
|
75
|
+
|
76
|
+
def htmlunitwithjs(opts = {})
|
77
|
+
new({
|
78
|
+
:browser_name => "htmlunit",
|
79
|
+
:javascript_enabled => true
|
80
|
+
}.merge(opts))
|
81
|
+
end
|
82
|
+
|
83
|
+
def internet_explorer(opts = {})
|
84
|
+
new({
|
85
|
+
:browser_name => "internet explorer",
|
86
|
+
:platform => :windows,
|
87
|
+
:takes_screenshot => true,
|
88
|
+
:css_selectors_enabled => true,
|
89
|
+
:native_events => true
|
90
|
+
}.merge(opts))
|
91
|
+
end
|
92
|
+
alias_method :ie, :internet_explorer
|
93
|
+
|
94
|
+
def iphone(opts = {})
|
95
|
+
new({
|
96
|
+
:browser_name => "iPhone",
|
97
|
+
:platform => :mac,
|
98
|
+
:javascript_enabled => true
|
99
|
+
}.merge(opts))
|
100
|
+
end
|
101
|
+
|
102
|
+
def ipad(opts = {})
|
103
|
+
new({
|
104
|
+
:browser_name => "iPad",
|
105
|
+
:platform => :mac,
|
106
|
+
:javascript_enabled => true
|
107
|
+
}.merge(opts))
|
108
|
+
end
|
109
|
+
|
110
|
+
def opera(opts = {})
|
111
|
+
new({
|
112
|
+
:browser_name => "opera",
|
113
|
+
:javascript_enabled => true,
|
114
|
+
:takes_screenshot => true,
|
115
|
+
:css_selectors_enabled => true
|
116
|
+
}.merge(opts))
|
117
|
+
end
|
118
|
+
|
119
|
+
def phantomjs(opts = {})
|
120
|
+
new({
|
121
|
+
:browser_name => "phantomjs",
|
122
|
+
:javascript_enabled => true,
|
123
|
+
:takes_screenshot => true,
|
124
|
+
:css_selectors_enabled => true
|
125
|
+
}.merge(opts))
|
126
|
+
end
|
127
|
+
|
128
|
+
def safari(opts = {})
|
129
|
+
new({
|
130
|
+
:browser_name => "safari",
|
131
|
+
:javascript_enabled => true,
|
132
|
+
:takes_screenshot => true,
|
133
|
+
:css_selectors_enabled => true
|
134
|
+
}.merge(opts))
|
135
|
+
end
|
136
|
+
|
137
|
+
#
|
138
|
+
# @api private
|
139
|
+
#
|
140
|
+
|
141
|
+
def json_create(data)
|
142
|
+
data = data.dup
|
143
|
+
|
144
|
+
caps = new
|
145
|
+
caps.browser_name = data.delete("browserName")
|
146
|
+
caps.version = data.delete("version")
|
147
|
+
caps.platform = data.delete("platform").downcase.to_sym if data.has_key?('platform')
|
148
|
+
caps.javascript_enabled = data.delete("javascriptEnabled")
|
149
|
+
caps.css_selectors_enabled = data.delete("cssSelectorsEnabled")
|
150
|
+
caps.takes_screenshot = data.delete("takesScreenshot")
|
151
|
+
caps.native_events = data.delete("nativeEvents")
|
152
|
+
caps.rotatable = data.delete("rotatable")
|
153
|
+
caps.proxy = Proxy.json_create(data['proxy']) if data.has_key?('proxy')
|
154
|
+
|
155
|
+
# any remaining pairs will be added as is, with no conversion
|
156
|
+
caps.merge!(data)
|
157
|
+
|
158
|
+
caps
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# @option :browser_name [String] required browser name
|
163
|
+
# @option :version [String] required browser version number
|
164
|
+
# @option :platform [Symbol] one of :any, :win, :mac, or :x
|
165
|
+
# @option :javascript_enabled [Boolean] does the driver have javascript enabled?
|
166
|
+
# @option :css_selectors_enabled [Boolean] does the driver support CSS selectors?
|
167
|
+
# @option :takes_screenshot [Boolean] can this driver take screenshots?
|
168
|
+
# @option :native_events [Boolean] does this driver use native events?
|
169
|
+
# @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
|
170
|
+
#
|
171
|
+
# Firefox-specific options:
|
172
|
+
#
|
173
|
+
# @option :firefox_profile [Selenium::WebDriver::Firefox::Profile] the firefox profile to use
|
174
|
+
#
|
175
|
+
# @api public
|
176
|
+
#
|
177
|
+
|
178
|
+
def initialize(opts = {})
|
179
|
+
@capabilities = DEFAULTS.merge(opts)
|
180
|
+
self.proxy = opts.delete(:proxy)
|
181
|
+
end
|
182
|
+
|
183
|
+
#
|
184
|
+
# Allows setting arbitrary capabilities.
|
185
|
+
#
|
186
|
+
|
187
|
+
def []=(key, value)
|
188
|
+
@capabilities[key] = value
|
189
|
+
end
|
190
|
+
|
191
|
+
def [](key)
|
192
|
+
@capabilities[key]
|
193
|
+
end
|
194
|
+
|
195
|
+
def merge!(other)
|
196
|
+
if other.respond_to?(:capabilities, true) && other.capabilities.kind_of?(Hash)
|
197
|
+
@capabilities.merge! other.capabilities
|
198
|
+
elsif other.kind_of? Hash
|
199
|
+
@capabilities.merge! other
|
200
|
+
else
|
201
|
+
raise ArgumentError, "argument should be a Hash or implement #capabilities"
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def proxy=(proxy)
|
206
|
+
case proxy
|
207
|
+
when Hash
|
208
|
+
@capabilities[:proxy] = Proxy.new(proxy)
|
209
|
+
when Proxy, nil
|
210
|
+
@capabilities[:proxy] = proxy
|
211
|
+
else
|
212
|
+
raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
# @api private
|
217
|
+
#
|
218
|
+
|
219
|
+
def as_json(opts = nil)
|
220
|
+
hash = {}
|
221
|
+
|
222
|
+
@capabilities.each do |key, value|
|
223
|
+
case key
|
224
|
+
when :platform
|
225
|
+
hash['platform'] = value.to_s.upcase
|
226
|
+
when :firefox_profile
|
227
|
+
hash['firefox_profile'] = value.as_json['zip'] if value
|
228
|
+
when :proxy
|
229
|
+
hash['proxy'] = value.as_json if value
|
230
|
+
when String, :firefox_binary
|
231
|
+
hash[key.to_s] = value
|
232
|
+
when Symbol
|
233
|
+
hash[camel_case(key.to_s)] = value
|
234
|
+
else
|
235
|
+
raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
hash
|
240
|
+
end
|
241
|
+
|
242
|
+
def to_json(*args)
|
243
|
+
WebDriver.json_dump as_json
|
244
|
+
end
|
245
|
+
|
246
|
+
def ==(other)
|
247
|
+
return false unless other.kind_of? self.class
|
248
|
+
as_json == other.as_json
|
249
|
+
end
|
250
|
+
alias_method :eql?, :==
|
251
|
+
|
252
|
+
protected
|
253
|
+
|
254
|
+
def capabilities
|
255
|
+
@capabilities
|
256
|
+
end
|
257
|
+
|
258
|
+
private
|
259
|
+
|
260
|
+
def camel_case(str)
|
261
|
+
str.gsub(/_([a-z])/) { $1.upcase }
|
262
|
+
end
|
263
|
+
|
264
|
+
end # Capabilities
|
265
|
+
end # Remote
|
266
|
+
end # WebDriver
|
267
|
+
end # Selenium
|
@@ -0,0 +1,193 @@
|
|
1
|
+
# @api private
|
2
|
+
class Selenium::WebDriver::Remote::Bridge
|
3
|
+
|
4
|
+
#
|
5
|
+
# http://code.google.com/p/selenium/wiki/JsonWireProtocol#Command_Reference
|
6
|
+
#
|
7
|
+
|
8
|
+
command :newSession, :post, "session"
|
9
|
+
command :getCapabilities, :get, "session/:session_id"
|
10
|
+
command :status, :get, "status"
|
11
|
+
|
12
|
+
#
|
13
|
+
# basic driver
|
14
|
+
#
|
15
|
+
|
16
|
+
command :getCurrentUrl, :get, "session/:session_id/url"
|
17
|
+
command :get, :post, "session/:session_id/url"
|
18
|
+
command :goForward, :post, "session/:session_id/forward"
|
19
|
+
command :goBack, :post, "session/:session_id/back"
|
20
|
+
command :refresh, :post, "session/:session_id/refresh"
|
21
|
+
command :quit, :delete, "session/:session_id"
|
22
|
+
command :close, :delete, "session/:session_id/window"
|
23
|
+
command :getVisible, :get, "session/:session_id/visible"
|
24
|
+
command :setVisible, :post, "session/:session_id/visible"
|
25
|
+
command :getPageSource, :get, "session/:session_id/source"
|
26
|
+
command :getTitle, :get, "session/:session_id/title"
|
27
|
+
command :findElement, :post, "session/:session_id/element"
|
28
|
+
command :findElements, :post, "session/:session_id/elements"
|
29
|
+
command :getActiveElement, :post, "session/:session_id/element/active"
|
30
|
+
|
31
|
+
#
|
32
|
+
# window handling
|
33
|
+
#
|
34
|
+
|
35
|
+
command :getCurrentWindowHandle, :get, "session/:session_id/window_handle"
|
36
|
+
command :getWindowHandles, :get, "session/:session_id/window_handles"
|
37
|
+
command :setWindowSize, :post, "session/:session_id/window/:window_handle/size"
|
38
|
+
command :setWindowPosition, :post, "session/:session_id/window/:window_handle/position"
|
39
|
+
command :getWindowSize, :get, "session/:session_id/window/:window_handle/size"
|
40
|
+
command :getWindowPosition, :get, "session/:session_id/window/:window_handle/position"
|
41
|
+
command :maximizeWindow, :post, "session/:session_id/window/:window_handle/maximize"
|
42
|
+
|
43
|
+
#
|
44
|
+
# script execution
|
45
|
+
#
|
46
|
+
|
47
|
+
command :executeScript, :post, "session/:session_id/execute"
|
48
|
+
command :executeAsyncScript, :post, "session/:session_id/execute_async"
|
49
|
+
|
50
|
+
#
|
51
|
+
# screenshot
|
52
|
+
#
|
53
|
+
|
54
|
+
command :screenshot, :get, "session/:session_id/screenshot"
|
55
|
+
|
56
|
+
#
|
57
|
+
# alerts
|
58
|
+
#
|
59
|
+
|
60
|
+
command :dismissAlert, :post, "session/:session_id/dismiss_alert"
|
61
|
+
command :acceptAlert, :post, "session/:session_id/accept_alert"
|
62
|
+
command :getAlertText, :get, "session/:session_id/alert_text"
|
63
|
+
command :setAlertValue, :post, "session/:session_id/alert_text"
|
64
|
+
|
65
|
+
#
|
66
|
+
# target locator
|
67
|
+
#
|
68
|
+
|
69
|
+
command :switchToFrame, :post, "session/:session_id/frame"
|
70
|
+
command :switchToWindow, :post, "session/:session_id/window"
|
71
|
+
|
72
|
+
#
|
73
|
+
# options
|
74
|
+
#
|
75
|
+
|
76
|
+
command :getCookies, :get, "session/:session_id/cookie"
|
77
|
+
command :addCookie, :post, "session/:session_id/cookie"
|
78
|
+
command :deleteAllCookies, :delete, "session/:session_id/cookie"
|
79
|
+
command :deleteCookie, :delete, "session/:session_id/cookie/:name"
|
80
|
+
|
81
|
+
#
|
82
|
+
# timeouts
|
83
|
+
#
|
84
|
+
|
85
|
+
command :implicitlyWait, :post, "session/:session_id/timeouts/implicit_wait"
|
86
|
+
command :setScriptTimeout, :post, "session/:session_id/timeouts/async_script"
|
87
|
+
command :setTimeout, :post, "session/:session_id/timeouts"
|
88
|
+
|
89
|
+
#
|
90
|
+
# element
|
91
|
+
#
|
92
|
+
|
93
|
+
command :describeElement, :get, "session/:session_id/element/:id"
|
94
|
+
command :findChildElement, :post, "session/:session_id/element/:id/element"
|
95
|
+
command :findChildElements, :post, "session/:session_id/element/:id/elements"
|
96
|
+
command :clickElement, :post, "session/:session_id/element/:id/click"
|
97
|
+
command :submitElement, :post, "session/:session_id/element/:id/submit"
|
98
|
+
command :getElementValue, :get, "session/:session_id/element/:id/value"
|
99
|
+
command :sendKeysToElement, :post, "session/:session_id/element/:id/value"
|
100
|
+
command :uploadFile, :post, "session/:session_id/file"
|
101
|
+
command :getElementTagName, :get, "session/:session_id/element/:id/name"
|
102
|
+
command :clearElement, :post, "session/:session_id/element/:id/clear"
|
103
|
+
command :isElementSelected, :get, "session/:session_id/element/:id/selected"
|
104
|
+
command :isElementEnabled, :get, "session/:session_id/element/:id/enabled"
|
105
|
+
command :getElementAttribute, :get, "session/:session_id/element/:id/attribute/:name"
|
106
|
+
command :elementEquals, :get, "session/:session_id/element/:id/equals/:other"
|
107
|
+
command :isElementDisplayed, :get, "session/:session_id/element/:id/displayed"
|
108
|
+
command :getElementLocation, :get, "session/:session_id/element/:id/location"
|
109
|
+
command :getElementLocationOnceScrolledIntoView, :get, "session/:session_id/element/:id/location_in_view"
|
110
|
+
command :getElementSize, :get, "session/:session_id/element/:id/size"
|
111
|
+
command :dragElement, :post, "session/:session_id/element/:id/drag"
|
112
|
+
command :getElementValueOfCssProperty, :get, "session/:session_id/element/:id/css/:property_name"
|
113
|
+
command :getElementText, :get, "session/:session_id/element/:id/text"
|
114
|
+
|
115
|
+
#
|
116
|
+
# rotatable
|
117
|
+
#
|
118
|
+
|
119
|
+
command :getScreenOrientation, :get, "session/:session_id/orientation"
|
120
|
+
command :setScreenOrientation, :post, "session/:session_id/orientation"
|
121
|
+
|
122
|
+
#
|
123
|
+
# interactions API
|
124
|
+
#
|
125
|
+
|
126
|
+
command :click, :post, "session/:session_id/click"
|
127
|
+
command :doubleClick, :post, "session/:session_id/doubleclick"
|
128
|
+
command :mouseDown, :post, "session/:session_id/buttondown"
|
129
|
+
command :mouseUp, :post, "session/:session_id/buttonup"
|
130
|
+
command :mouseMoveTo, :post, "session/:session_id/moveto"
|
131
|
+
command :sendModifierKeyToActiveElement, :post, "session/:session_id/modifier"
|
132
|
+
command :sendKeysToActiveElement, :post, "session/:session_id/keys"
|
133
|
+
|
134
|
+
#
|
135
|
+
# html 5
|
136
|
+
#
|
137
|
+
|
138
|
+
command :executeSql, :post, "session/:session_id/execute_sql"
|
139
|
+
|
140
|
+
command :getLocation, :get, "session/:session_id/location"
|
141
|
+
command :setLocation, :post, "session/:session_id/location"
|
142
|
+
|
143
|
+
command :getAppCache, :get, "session/:session_id/application_cache"
|
144
|
+
command :getAppCacheStatus, :get, "session/:session_id/application_cache/status"
|
145
|
+
command :clearAppCache, :delete, "session/:session_id/application_cache/clear"
|
146
|
+
|
147
|
+
command :isBrowserOnline, :get, "session/:session_id/browser_connection"
|
148
|
+
command :setBrowserOnline, :post, "session/:session_id/browser_connection"
|
149
|
+
|
150
|
+
command :getLocalStorageItem, :get, "session/:session_id/local_storage/key/:key"
|
151
|
+
command :removeLocalStorageItem, :delete, "session/:session_id/local_storage/key/:key"
|
152
|
+
command :getLocalStorageKeys, :get, "session/:session_id/local_storage"
|
153
|
+
command :setLocalStorageItem, :post, "session/:session_id/local_storage"
|
154
|
+
command :clearLocalStorage, :delete, "session/:session_id/local_storage"
|
155
|
+
command :getLocalStorageSize, :get, "session/:session_id/local_storage/size"
|
156
|
+
|
157
|
+
command :getSessionStorageItem, :get, "session/:session_id/session_storage/key/:key"
|
158
|
+
command :removeSessionStorageItem, :delete, "session/:session_id/session_storage/key/:key"
|
159
|
+
command :getSessionStorageKeys, :get, "session/:session_id/session_storage"
|
160
|
+
command :setSessionStorageItem, :post, "session/:session_id/session_storage"
|
161
|
+
command :clearSessionStorage, :delete, "session/:session_id/session_storage"
|
162
|
+
command :getSessionStorageSize, :get, "session/:session_id/session_storage/size"
|
163
|
+
|
164
|
+
#
|
165
|
+
# ime
|
166
|
+
#
|
167
|
+
|
168
|
+
command :imeGetAvailableEngines, :get, "session/:session_id/ime/available_engines"
|
169
|
+
command :imeGetActiveEngine, :get, "session/:session_id/ime/active_engine"
|
170
|
+
command :imeIsActivated, :get, "session/:session_id/ime/activated"
|
171
|
+
command :imeDeactivate, :post, "session/:session_id/ime/deactivate"
|
172
|
+
command :imeActivateEngine, :post, "session/:session_id/ime/activate"
|
173
|
+
|
174
|
+
#
|
175
|
+
# touch
|
176
|
+
#
|
177
|
+
|
178
|
+
command :touchSingleTap, :post, "session/:session_id/touch/click"
|
179
|
+
command :touchDoubleTap, :post, "session/:session_id/touch/doubleclick"
|
180
|
+
command :touchLongPress, :post, "session/:session_id/touch/longclick"
|
181
|
+
command :touchDown, :post, "session/:session_id/touch/down"
|
182
|
+
command :touchUp, :post, "session/:session_id/touch/up"
|
183
|
+
command :touchMove, :post, "session/:session_id/touch/move"
|
184
|
+
command :touchScroll, :post, "session/:session_id/touch/scroll"
|
185
|
+
command :touchFlick, :post, "session/:session_id/touch/flick"
|
186
|
+
|
187
|
+
#
|
188
|
+
# logs
|
189
|
+
#
|
190
|
+
|
191
|
+
command :getAvailableLogTypes, :get, "session/:session_id/log/types"
|
192
|
+
command :getLog, :post, "session/:session_id/log"
|
193
|
+
end
|