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,228 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Remote
23
- #
24
- # Specification of the desired and/or actual capabilities of the browser that the
25
- # server is being asked to create.
26
- #
27
- class W3CCapabilities
28
- DEFAULTS = {
29
- browser_name: '',
30
- browser_version: :any,
31
- platform_name: :any,
32
- platform_version: :any,
33
- accept_ssl_certs: false,
34
- page_load_strategy: 'normal',
35
- proxy: nil
36
- }.freeze
37
-
38
- KNOWN = [
39
- :remote_session_id,
40
- :xul_app_id,
41
- :raise_accessibility_exceptions,
42
- :rotatable,
43
- :app_build_id,
44
- :device
45
- ].freeze
46
-
47
- (DEFAULTS.keys + KNOWN).each do |key|
48
- define_method key do
49
- @capabilities.fetch(key)
50
- end
51
-
52
- define_method "#{key}=" do |value|
53
- @capabilities[key] = value
54
- end
55
- end
56
-
57
- #
58
- # Backward compatibility
59
- #
60
-
61
- alias_method :version, :browser_version
62
- alias_method :version=, :browser_version=
63
- alias_method :platform, :platform_name
64
- alias_method :platform=, :platform_name=
65
-
66
- #
67
- # Convenience methods for the common choices.
68
- #
69
-
70
- class << self
71
- def edge(opts = {})
72
- new({
73
- browser_name: 'MicrosoftEdge',
74
- platform: :windows
75
- }.merge(opts))
76
- end
77
-
78
- def firefox(opts = {})
79
- opts[:browser_version] = opts.delete :version
80
- opts[:platform_name] = opts.delete :platform
81
-
82
- new({browser_name: 'firefox'}.merge(opts))
83
- end
84
-
85
- alias_method :ff, :firefox
86
-
87
- def w3c?(opts = {})
88
- !opts[:desired_capabilities].is_a?(Capabilities)
89
- end
90
-
91
- #
92
- # @api private
93
- #
94
-
95
- def json_create(data)
96
- data = data.dup
97
-
98
- # Convert due to Remote Driver implementation
99
- data['browserVersion'] = data.delete('version') if data.key? 'version'
100
- data['platformName'] = data.delete('platform') if data.key? 'platform'
101
-
102
- caps = new
103
- caps.browser_name = data.delete('browserName')
104
- caps.browser_version = data.delete('browserVersion')
105
- caps.platform_name = data.delete('platformName')
106
- caps.platform_version = data.delete('platformVersion')
107
- caps.accept_ssl_certs = data.delete('acceptSslCerts')
108
- caps.page_load_strategy = data.delete('pageLoadStrategy')
109
- proxy = data.delete('proxy')
110
- caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
111
-
112
- # Remote Server Specific
113
- caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
114
-
115
- # Obsolete capabilities returned by Remote Server
116
- data.delete('javascriptEnabled')
117
- data.delete('cssSelectorsEnabled')
118
-
119
- # Marionette Specific
120
- caps[:xul_app_id] = data.delete('XULappId')
121
- caps[:raise_accessibility_exceptions] = data.delete('raisesAccessibilityExceptions')
122
- caps[:rotatable] = data.delete('rotatable')
123
- caps[:app_build_id] = data.delete('appBuildId')
124
- caps[:device] = data.delete('device')
125
-
126
- # any remaining pairs will be added as is, with no conversion
127
- caps.merge!(data)
128
- caps
129
- end
130
- end
131
-
132
- # @param [Hash] opts
133
- # @option :browser_name [String] required browser name
134
- # @option :browser_version [String] required browser version number
135
- # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
136
- # @option :platform_version [String] required platform version number
137
- # @option :accept_ssl_certs [Boolean] does the driver accept SSL Cerfifications?
138
- # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
139
- #
140
- # @api public
141
- #
142
-
143
- def initialize(opts = {})
144
- @capabilities = DEFAULTS.merge(opts)
145
- self.proxy = opts.delete(:proxy)
146
- end
147
-
148
- #
149
- # Allows setting arbitrary capabilities.
150
- #
151
-
152
- def []=(key, value)
153
- @capabilities[key] = value
154
- end
155
-
156
- def [](key)
157
- @capabilities[key]
158
- end
159
-
160
- def merge!(other)
161
- if other.respond_to?(:capabilities, true) && other.capabilities.is_a?(Hash)
162
- @capabilities.merge! other.capabilities
163
- elsif other.is_a? Hash
164
- @capabilities.merge! other
165
- else
166
- raise ArgumentError, 'argument should be a Hash or implement #capabilities'
167
- end
168
- end
169
-
170
- def proxy=(proxy)
171
- case proxy
172
- when Hash
173
- @capabilities[:proxy] = Proxy.new(proxy)
174
- when Proxy, nil
175
- @capabilities[:proxy] = proxy
176
- else
177
- raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
178
- end
179
- end
180
-
181
- # @api private
182
- #
183
-
184
- def as_json(*)
185
- hash = {}
186
-
187
- @capabilities.each do |key, value|
188
- case key
189
- when :platform
190
- hash['platform'] = value.to_s.upcase
191
- when :proxy
192
- hash['proxy'] = value.as_json if value
193
- when String, :firefox_binary
194
- hash[key.to_s] = value
195
- when Symbol
196
- hash[camel_case(key.to_s)] = value
197
- else
198
- raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
199
- end
200
- end
201
-
202
- hash
203
- end
204
-
205
- def to_json(*)
206
- JSON.generate as_json
207
- end
208
-
209
- def ==(other)
210
- return false unless other.is_a? self.class
211
- as_json == other.as_json
212
- end
213
-
214
- alias_method :eql?, :==
215
-
216
- protected
217
-
218
- attr_reader :capabilities
219
-
220
- private
221
-
222
- def camel_case(str)
223
- str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
224
- end
225
- end # W3CCapabilities
226
- end # Remote
227
- end # WebDriver
228
- end # Selenium
@@ -1,135 +0,0 @@
1
- # encoding: utf-8
2
- #
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Remote
23
- class W3CBridge
24
- #
25
- # http://www.w3.org/TR/2015/WD-webdriver-20150918/#list-of-endpoints
26
- #
27
-
28
- #
29
- # session handling
30
- #
31
-
32
- command :newSession, :post, 'session'
33
- command :deleteSession, :delete, 'session/:session_id'
34
-
35
- #
36
- # basic driver
37
- #
38
-
39
- command :get, :post, 'session/:session_id/url'
40
- command :getCurrentUrl, :get, 'session/:session_id/url'
41
- command :back, :post, 'session/:session_id/back'
42
- command :forward, :post, 'session/:session_id/forward'
43
- command :refresh, :post, 'session/:session_id/refresh'
44
- command :getTitle, :get, 'session/:session_id/title'
45
-
46
- #
47
- # window and Frame handling
48
- #
49
-
50
- command :getWindowHandle, :get, 'session/:session_id/window'
51
- command :closeWindow, :delete, 'session/:session_id/window'
52
- command :switchToWindow, :post, 'session/:session_id/window'
53
- command :getWindowHandles, :get, 'session/:session_id/window/handles'
54
- command :fullscreenWindow, :post, 'session/:session_id/window/fullscreen'
55
- command :maximizeWindow, :post, 'session/:session_id/window/maximize'
56
- command :setWindowSize, :post, 'session/:session_id/window/size'
57
- command :getWindowSize, :get, 'session/:session_id/window/size'
58
- command :switchToFrame, :post, 'session/:session_id/frame'
59
- command :switchToParentFrame, :post, 'session/:session_id/frame/parent'
60
-
61
- #
62
- # element
63
- #
64
-
65
- command :findElement, :post, 'session/:session_id/element'
66
- command :findElements, :post, 'session/:session_id/elements'
67
- command :findChildElement, :post, 'session/:session_id/element/:id/element'
68
- command :findChildElements, :post, 'session/:session_id/element/:id/elements'
69
- command :getActiveElement, :get, 'session/:session_id/element/active'
70
- command :isElementSelected, :get, 'session/:session_id/element/:id/selected'
71
- command :getElementAttribute, :get, 'session/:session_id/element/:id/attribute/:name'
72
- command :getElementProperty, :get, 'session/:session_id/element/:id/property/:name'
73
- command :getElementCssValue, :get, 'session/:session_id/element/:id/css/:property_name'
74
- command :getElementText, :get, 'session/:session_id/element/:id/text'
75
- command :getElementTagName, :get, 'session/:session_id/element/:id/name'
76
- command :getElementRect, :get, 'session/:session_id/element/:id/rect'
77
- command :isElementEnabled, :get, 'session/:session_id/element/:id/enabled'
78
-
79
- #
80
- # document handling
81
- #
82
-
83
- command :getPageSource, :get, '/session/:session_id/source'
84
- command :executeScript, :post, 'session/:session_id/execute/sync'
85
- command :executeAsyncScript, :post, 'session/:session_id/execute/async'
86
-
87
- #
88
- # cookies
89
- #
90
-
91
- command :getAllCookies, :get, 'session/:session_id/cookie'
92
- command :getCookie, :get, 'session/:session_id/cookie/:name'
93
- command :addCookie, :post, 'session/:session_id/cookie'
94
- command :deleteCookie, :delete, 'session/:session_id/cookie/:name'
95
-
96
- #
97
- # timeouts
98
- #
99
-
100
- command :setTimeout, :post, 'session/:session_id/timeouts'
101
-
102
- #
103
- # actions
104
- #
105
-
106
- command :actions, :post, 'session/:session_id/actions'
107
-
108
- #
109
- # Element Operations
110
- #
111
-
112
- command :elementClick, :post, 'session/:session_id/element/:id/click'
113
- command :elementTap, :post, 'session/:session_id/element/:id/tap'
114
- command :elementClear, :post, 'session/:session_id/element/:id/clear'
115
- command :elementSendKeys, :post, 'session/:session_id/element/:id/value'
116
-
117
- #
118
- # alerts
119
- #
120
-
121
- command :dismissAlert, :post, 'session/:session_id/alert/dismiss'
122
- command :acceptAlert, :post, 'session/:session_id/alert/accept'
123
- command :getAlertText, :get, 'session/:session_id/alert/text'
124
- command :sendAlertText, :post, 'session/:session_id/alert/text'
125
-
126
- #
127
- # screenshot
128
- #
129
-
130
- command :takeScreenshot, :get, 'session/:session_id/screenshot'
131
- command :takeElementScreenshot, :get, 'session/:session_id/element/:id/screenshot'
132
- end
133
- end # Remote
134
- end # WebDriver
135
- end # Selenium