selenium-webdriver 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/CHANGES +35 -1
  2. data/Gemfile.lock +54 -0
  3. data/lib/selenium/webdriver.rb +8 -10
  4. data/lib/selenium/webdriver/chrome.rb +2 -1
  5. data/lib/selenium/webdriver/chrome/{bridge.rb → driver.rb} +47 -32
  6. data/lib/selenium/webdriver/chrome/options.rb +170 -0
  7. data/lib/selenium/webdriver/common/driver.rb +20 -39
  8. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +5 -0
  9. data/lib/selenium/webdriver/common/element.rb +5 -1
  10. data/lib/selenium/webdriver/common/logger.rb +10 -0
  11. data/lib/selenium/webdriver/common/w3c_error.rb +2 -2
  12. data/lib/selenium/webdriver/edge.rb +2 -1
  13. data/lib/selenium/webdriver/edge/bridge.rb +2 -91
  14. data/lib/selenium/webdriver/edge/driver.rb +80 -0
  15. data/lib/selenium/webdriver/firefox.rb +6 -3
  16. data/lib/selenium/webdriver/firefox/driver.rb +50 -0
  17. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  18. data/lib/selenium/webdriver/firefox/legacy/driver.rb +81 -0
  19. data/lib/selenium/webdriver/firefox/marionette/driver.rb +101 -0
  20. data/lib/selenium/webdriver/firefox/options.rb +139 -0
  21. data/lib/selenium/webdriver/ie.rb +1 -1
  22. data/lib/selenium/webdriver/ie/{bridge.rb → driver.rb} +13 -13
  23. data/lib/selenium/webdriver/phantomjs.rb +1 -1
  24. data/lib/selenium/webdriver/phantomjs/{bridge.rb → driver.rb} +10 -13
  25. data/lib/selenium/webdriver/remote.rb +11 -13
  26. data/lib/selenium/webdriver/remote/bridge.rb +87 -586
  27. data/lib/selenium/webdriver/remote/capabilities.rb +3 -1
  28. data/lib/selenium/webdriver/remote/driver.rb +44 -0
  29. data/lib/selenium/webdriver/remote/http/default.rb +1 -1
  30. data/lib/selenium/webdriver/remote/oss/bridge.rb +586 -0
  31. data/lib/selenium/webdriver/remote/{commands.rb → oss/commands.rb} +9 -5
  32. data/lib/selenium/webdriver/remote/oss/driver.rb +44 -0
  33. data/lib/selenium/webdriver/remote/w3c/bridge.rb +573 -0
  34. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +266 -0
  35. data/lib/selenium/webdriver/remote/{w3c_commands.rb → w3c/commands.rb} +9 -4
  36. data/lib/selenium/webdriver/remote/w3c/driver.rb +41 -0
  37. data/lib/selenium/webdriver/safari.rb +3 -6
  38. data/lib/selenium/webdriver/safari/{bridge.rb → driver.rb} +14 -6
  39. data/selenium-webdriver.gemspec +1 -3
  40. metadata +29 -45
  41. data/lib/selenium/webdriver/firefox/bridge.rb +0 -70
  42. data/lib/selenium/webdriver/firefox/w3c_bridge.rb +0 -114
  43. data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -663
  44. data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -231
@@ -1,231 +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
-
28
- # TODO - uncomment when Mozilla fixes this:
29
- # https://bugzilla.mozilla.org/show_bug.cgi?id=1326397
30
- class W3CCapabilities
31
- KNOWN = [
32
- :browser_name,
33
- :browser_version,
34
- :platform_name,
35
- :platform_version,
36
- :accept_insecure_certs,
37
- :page_load_strategy,
38
- :proxy,
39
- :remote_session_id,
40
- :accessibility_checks,
41
- :rotatable,
42
- :device,
43
- :implicit_timeout,
44
- :page_load_timeout,
45
- :script_timeout,
46
- ].freeze
47
-
48
- KNOWN.each do |key|
49
- define_method key do
50
- @capabilities.fetch(key)
51
- end
52
-
53
- define_method "#{key}=" do |value|
54
- @capabilities[key] = value
55
- end
56
- end
57
-
58
- #
59
- # Backward compatibility
60
- #
61
-
62
- alias_method :version, :browser_version
63
- alias_method :version=, :browser_version=
64
- alias_method :platform, :platform_name
65
- alias_method :platform=, :platform_name=
66
-
67
- #
68
- # Convenience methods for the common choices.
69
- #
70
-
71
- class << self
72
- def edge(opts = {})
73
- new({
74
- browser_name: 'MicrosoftEdge',
75
- platform: :windows
76
- }.merge(opts))
77
- end
78
-
79
- def firefox(opts = {})
80
- opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
81
- opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
82
- opts[:timeouts] = {}
83
- opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
84
- opts[:timeouts]['page load'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
85
- opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
86
- new({browser_name: 'firefox', marionette: true}.merge(opts))
87
- end
88
-
89
- alias_method :ff, :firefox
90
-
91
- def w3c?(opts = {})
92
- opts[:marionette] != false &&
93
- (!opts[:desired_capabilities] || opts[:desired_capabilities][:marionette] != false)
94
- end
95
-
96
- #
97
- # @api private
98
- #
99
-
100
- def json_create(data)
101
- data = data.dup
102
-
103
- caps = new
104
- caps.browser_name = data.delete('browserName')
105
- caps.browser_version = data.delete('browserVersion')
106
- caps.platform_name = data.delete('platformName')
107
- caps.platform_version = data.delete('platformVersion')
108
- caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
109
- caps.page_load_strategy = data.delete('pageLoadStrategy')
110
- timeouts = data.delete('timeouts')
111
- caps.implicit_timeout = timeouts['implicit'] if timeouts
112
- caps.page_load_timeout = timeouts['pageLoad'] if timeouts
113
- caps.script_timeout = timeouts['script'] if timeouts
114
-
115
- proxy = data.delete('proxy')
116
- caps.proxy = Proxy.json_create(proxy) unless proxy.nil? || proxy.empty?
117
-
118
- # Remote Server Specific
119
- caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
120
-
121
- # Marionette Specific
122
- caps[:accessibility_checks] = data.delete('moz:accessibilityChecks')
123
- caps[:profile] = data.delete('moz:profile')
124
- caps[:rotatable] = data.delete('rotatable')
125
- caps[:device] = data.delete('device')
126
-
127
- # any remaining pairs will be added as is, with no conversion
128
- caps.merge!(data)
129
- caps
130
- end
131
- end
132
-
133
- # @param [Hash] opts
134
- # @option :browser_name [String] required browser name
135
- # @option :browser_version [String] required browser version number
136
- # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
137
- # @option :platform_version [String] required platform version number
138
- # @option :accept_insecure_certs [Boolean] does the driver accept SSL Cerfifications?
139
- # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
140
- #
141
- # @api public
142
- #
143
-
144
- def initialize(opts = {})
145
- @capabilities = opts
146
- self.proxy = opts.delete(:proxy)
147
- end
148
-
149
- #
150
- # Allows setting arbitrary capabilities.
151
- #
152
-
153
- def []=(key, value)
154
- @capabilities[key] = value
155
- end
156
-
157
- def [](key)
158
- @capabilities[key]
159
- end
160
-
161
- def merge!(other)
162
- if other.respond_to?(:capabilities, true) && other.capabilities.is_a?(Hash)
163
- @capabilities.merge! other.capabilities
164
- elsif other.is_a? Hash
165
- @capabilities.merge! other
166
- else
167
- raise ArgumentError, 'argument should be a Hash or implement #capabilities'
168
- end
169
- end
170
-
171
- def proxy=(proxy)
172
- case proxy
173
- when Hash
174
- @capabilities[:proxy] = Proxy.new(proxy)
175
- when Proxy, nil
176
- @capabilities[:proxy] = proxy
177
- else
178
- raise TypeError, "expected Hash or #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
179
- end
180
- end
181
-
182
- # @api private
183
- #
184
-
185
- def as_json(*)
186
- hash = {}
187
-
188
- @capabilities.each do |key, value|
189
- case key
190
- when :platform
191
- hash['platform'] = value.to_s.upcase
192
- when :proxy
193
- hash['proxy'] = value.as_json if value
194
- when :firefox_options
195
- hash['moz:firefoxOptions'] = value
196
- when String, :firefox_binary
197
- hash[key.to_s] = value
198
- when Symbol
199
- hash[camel_case(key.to_s)] = value
200
- else
201
- raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class} / #{value.inspect}"
202
- end
203
- end
204
-
205
- hash
206
- end
207
-
208
- def to_json(*)
209
- JSON.generate as_json
210
- end
211
-
212
- def ==(other)
213
- return false unless other.is_a? self.class
214
- as_json == other.as_json
215
- end
216
-
217
- alias_method :eql?, :==
218
-
219
- protected
220
-
221
- attr_reader :capabilities
222
-
223
- private
224
-
225
- def camel_case(str)
226
- str.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
227
- end
228
- end # W3CCapabilities
229
- end # Remote
230
- end # WebDriver
231
- end # Selenium