selenium-webdriver 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16d699e79466a2c8a00b7366541095880a570f21bc749523f5d55283cbd0b9a0
4
- data.tar.gz: 88d1396b5a026321de780a63b9333e5f9b9332570697049ac3e55ec097970b51
3
+ metadata.gz: 89c68b6ae8db07e10f1e0ead164a3d36f5294c62166d361b1ec1fa42647e3672
4
+ data.tar.gz: c1d0c0c2322acaaa95b98d5187315c975289282b3ee2085c14b86426b819de45
5
5
  SHA512:
6
- metadata.gz: 640c3f5921c1a9abb971cc0a90fd7a6053ac8806de54d7b8fbd35c19a066202ca9da0da3e43b01d81e8fe0adcbba72b0b616d14f5289f29da45c9fab7a20d919
7
- data.tar.gz: 0b261c01d7e2e3c54b8097e714932a923331fa25d30c7c970dd576dc9e0e44782ef9cb6dac1221ce209fd3e03ca7a241143ddba428468e97de21802360c82f21
6
+ metadata.gz: 120b0f57601862015b62dc9ae23b510ca2433342cc500ae4fe38a70550c07e91ff20e26fd2b5a03066830b8e1f06246d1e23151070207c1c8e5e4cfc37c20889
7
+ data.tar.gz: 3664cea6889b141e7de551ed518471fc2617ae6321c56981e898249fa688564aed92c5a05dba66333bf97457ed551e7051b009340a5e9abb91249e608633b416
data/CHANGES CHANGED
@@ -1,3 +1,21 @@
1
+ 4.3.0 (2022-06-23)
2
+ =========================
3
+
4
+ BiDi:
5
+ * Released selenium-devtools 0.103.0 (supports CDP v85, v101, v102, v103)
6
+
7
+ Ruby:
8
+ * Allow specifying which button is clicked in pointer action class methods
9
+ * Remove deprecated `Persistent` http class
10
+ * Remove deprecated HasRemoteStatus module
11
+ * Remove deprecated `Manager#new_window` and `Manager#logs`
12
+ * `ActionBuilder#move_to` no longer attempts to move to top left corner of element
13
+ * Remove deprecated support for sending Service parameters directly to Driver constructor
14
+ * Remove deprecated setters and getters for driver path on Browser modules
15
+ * Remove deprecated support for passing in options argument to Options class
16
+ * Allow `:options` parameter to take `Options` instance argument like other languages
17
+ * Remove deprecated support for `:desired_capabilities` & `:options` with `Hash` argument
18
+
1
19
  4.2.1 (2022-05-31)
2
20
  =========================
3
21
 
@@ -28,20 +28,6 @@ module Selenium
28
28
  autoload :Options, 'selenium/webdriver/chrome/options'
29
29
  autoload :Service, 'selenium/webdriver/chrome/service'
30
30
 
31
- def self.driver_path=(path)
32
- WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome#driver_path=',
33
- 'Selenium::WebDriver::Chrome::Service#driver_path=',
34
- id: :driver_path
35
- Selenium::WebDriver::Chrome::Service.driver_path = path
36
- end
37
-
38
- def self.driver_path
39
- WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome#driver_path',
40
- 'Selenium::WebDriver::Chrome::Service#driver_path',
41
- id: :driver_path
42
- Selenium::WebDriver::Chrome::Service.driver_path
43
- end
44
-
45
31
  def self.path=(path)
46
32
  Platform.assert_executable path
47
33
  @path = path
@@ -307,71 +307,29 @@ module Selenium
307
307
 
308
308
  attr_reader :bridge
309
309
 
310
- def create_bridge(**opts)
311
- opts[:url] ||= service_url(opts)
312
- caps = opts.delete(:capabilities)
313
- # NOTE: This is deprecated
314
- cap_array = caps.is_a?(Hash) ? [caps] : Array(caps)
315
-
316
- desired_capabilities = opts.delete(:desired_capabilities)
317
- if desired_capabilities
318
- WebDriver.logger.deprecate(':desired_capabilities as a parameter for driver initialization',
319
- ':capabilities with an Array value of capabilities/options if necessary',
320
- id: :desired_capabilities)
321
- desired_capabilities = Remote::Capabilities.new(desired_capabilities) if desired_capabilities.is_a?(Hash)
322
- cap_array << desired_capabilities
310
+ def create_bridge(capabilities: nil, options: nil, url: nil, service: nil, http_client: nil)
311
+ Remote::Bridge.new(http_client: http_client,
312
+ url: url || service_url(service)).tap do |bridge|
313
+ generated_caps = options ? options.as_json : generate_capabilities(capabilities)
314
+ bridge.create_session(generated_caps)
323
315
  end
324
-
325
- options = opts.delete(:options)
326
- if options
327
- WebDriver.logger.deprecate(':options as a parameter for driver initialization',
328
- ':capabilities with an Array of value capabilities/options if necessary',
329
- id: :browser_options)
330
- cap_array << options
331
- end
332
-
333
- capabilities = generate_capabilities(cap_array)
334
-
335
- bridge_opts = {http_client: opts.delete(:http_client), url: opts.delete(:url)}
336
- raise ArgumentError, "Unable to create a driver with parameters: #{opts}" unless opts.empty?
337
-
338
- bridge = Remote::Bridge.new(**bridge_opts)
339
-
340
- bridge.create_session(capabilities)
341
- bridge
342
316
  end
343
317
 
344
- def generate_capabilities(cap_array)
345
- cap_array.map { |cap|
318
+ def generate_capabilities(capabilities)
319
+ Array(capabilities).map { |cap|
346
320
  if cap.is_a? Symbol
347
321
  cap = Remote::Capabilities.send(cap)
348
- elsif cap.is_a? Hash
349
- new_message = 'Capabilities instance initialized with the Hash, or build values with Options class'
350
- WebDriver.logger.deprecate("passing a Hash value to :capabilities",
351
- new_message,
352
- id: :capabilities_hash)
353
- cap = Remote::Capabilities.new(cap)
354
322
  elsif !cap.respond_to? :as_json
355
323
  msg = ":capabilities parameter only accepts objects responding to #as_json which #{cap.class} does not"
356
324
  raise ArgumentError, msg
357
325
  end
358
- cap&.as_json
326
+ cap.as_json
359
327
  }.inject(:merge) || Remote::Capabilities.send(browser || :new)
360
328
  end
361
329
 
362
- def service_url(opts)
363
- service_config = opts.delete(:service)
364
- %i[driver_opts driver_path port].each do |key|
365
- next unless opts.key? key
366
-
367
- WebDriver.logger.deprecate(":#{key}", ':service with an instance of Selenium::WebDriver::Service',
368
- id: "service_#{key}".to_sym)
369
- end
370
- service_config ||= Service.send(browser,
371
- args: opts.delete(:driver_opts),
372
- path: opts.delete(:driver_path),
373
- port: opts.delete(:port))
374
- @service = service_config.launch
330
+ def service_url(service)
331
+ service ||= Service.send(browser)
332
+ @service = service.launch
375
333
  @service.uri
376
334
  end
377
335
 
@@ -98,22 +98,9 @@ module Selenium
98
98
 
99
99
  def move_to(element, right_by = nil, down_by = nil, device: nil, duration: default_move_duration, **opts)
100
100
  pointer = pointer_input(device)
101
- if right_by || down_by
102
- WebDriver.logger.warn("moving to an element with offset currently tries to use
103
- the top left corner of the element as the origin; in Selenium 4.3 it will use the in-view
104
- center point of the element as the origin.")
105
- size = element.size
106
- left_offset = (size[:width] / 2).to_i
107
- top_offset = (size[:height] / 2).to_i
108
- left = -left_offset + (right_by || 0)
109
- top = -top_offset + (down_by || 0)
110
- else
111
- left = 0
112
- top = 0
113
- end
114
101
  pointer.create_pointer_move(duration: duration,
115
- x: left,
116
- y: top,
102
+ x: right_by || 0,
103
+ y: down_by || 0,
117
104
  origin: element,
118
105
  **opts)
119
106
  tick(pointer)
@@ -192,9 +179,9 @@ center point of the element as the origin.")
192
179
  # @return [ActionBuilder] A self reference.
193
180
  #
194
181
 
195
- def click_and_hold(element = nil, device: nil)
182
+ def click_and_hold(element = nil, button: nil, device: nil)
196
183
  move_to(element, device: device) if element
197
- pointer_down(:left, device: device)
184
+ pointer_down(button || :left, device: device)
198
185
  self
199
186
  end
200
187
 
@@ -211,8 +198,8 @@ center point of the element as the origin.")
211
198
  # @return [ActionBuilder] A self reference.
212
199
  #
213
200
 
214
- def release(device: nil)
215
- pointer_up(:left, device: device)
201
+ def release(button: nil, device: nil)
202
+ pointer_up(button || :left, device: device)
216
203
  self
217
204
  end
218
205
 
@@ -238,10 +225,10 @@ center point of the element as the origin.")
238
225
  # @return [ActionBuilder] A self reference.
239
226
  #
240
227
 
241
- def click(element = nil, device: nil)
228
+ def click(element = nil, button: nil, device: nil)
242
229
  move_to(element, device: device) if element
243
- pointer_down(:left, device: device)
244
- pointer_up(:left, device: device)
230
+ pointer_down(button || :left, device: device)
231
+ pointer_up(button || :left, device: device)
245
232
  self
246
233
  end
247
234
 
@@ -296,10 +283,7 @@ center point of the element as the origin.")
296
283
  #
297
284
 
298
285
  def context_click(element = nil, device: nil)
299
- move_to(element, device: device) if element
300
- pointer_down(:right, device: device)
301
- pointer_up(:right, device: device)
302
- self
286
+ click(element, button: :right, device: device)
303
287
  end
304
288
 
305
289
  #
@@ -104,33 +104,6 @@ module Selenium
104
104
  @timeouts ||= Timeouts.new(@bridge)
105
105
  end
106
106
 
107
- def logs
108
- WebDriver.logger.deprecate('Manager#logs', 'Chrome::Driver#logs')
109
- @logs ||= Logs.new(@bridge)
110
- end
111
-
112
- #
113
- # @param type [Symbol] Supports two values: :tab and :window.
114
- # @return [String] The value of the window handle
115
- #
116
- def new_window(type = :tab)
117
- WebDriver.logger.deprecate('Manager#new_window', 'TargetLocator#new_window', id: :new_window) do
118
- 'e.g., `driver.switch_to.new_window(:tab)`'
119
- end
120
- case type
121
- when :tab, :window
122
- result = @bridge.new_window(type)
123
- unless result.key?('handle')
124
- raise UnknownError, "the driver did not return a handle. " \
125
- "The returned result: #{result.inspect}"
126
- end
127
- result['handle']
128
- else
129
- raise ArgumentError, "invalid argument for type. Got: '#{type.inspect}'. " \
130
- "Try :tab or :window"
131
- end
132
- end
133
-
134
107
  def window
135
108
  @window ||= Window.new(@bridge)
136
109
  end
@@ -66,17 +66,10 @@ module Selenium
66
66
 
67
67
  attr_accessor :options
68
68
 
69
- def initialize(options: nil, **opts)
69
+ def initialize(**opts)
70
70
  self.class.set_capabilities
71
71
 
72
- @options = if options
73
- WebDriver.logger.deprecate(":options as keyword for initializing #{self.class}",
74
- "custom values directly in #new constructor",
75
- id: :options_options)
76
- opts.merge(options)
77
- else
78
- opts
79
- end
72
+ @options = opts
80
73
  @options[:browser_name] = self.class::BROWSER
81
74
  end
82
75
 
@@ -64,7 +64,6 @@ require 'selenium/webdriver/common/driver_extensions/has_web_storage'
64
64
  require 'selenium/webdriver/common/driver_extensions/downloads_files'
65
65
  require 'selenium/webdriver/common/driver_extensions/has_location'
66
66
  require 'selenium/webdriver/common/driver_extensions/has_session_id'
67
- require 'selenium/webdriver/common/driver_extensions/has_remote_status'
68
67
  require 'selenium/webdriver/common/driver_extensions/has_network_conditions'
69
68
  require 'selenium/webdriver/common/driver_extensions/has_network_connection'
70
69
  require 'selenium/webdriver/common/driver_extensions/has_network_interception'
@@ -42,20 +42,6 @@ module Selenium
42
42
  # until WebDriver Bidi is available.
43
43
  DEVTOOLS_VERSION = 85
44
44
 
45
- def self.driver_path=(path)
46
- WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path=',
47
- 'Selenium::WebDriver::Firefox::Service#driver_path=',
48
- id: :driver_path
49
- Selenium::WebDriver::Firefox::Service.driver_path = path
50
- end
51
-
52
- def self.driver_path
53
- WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path',
54
- 'Selenium::WebDriver::Firefox::Service#driver_path',
55
- id: :driver_path
56
- Selenium::WebDriver::Firefox::Service.driver_path
57
- end
58
-
59
45
  def self.path=(path)
60
46
  Platform.assert_executable path
61
47
  @path = path
@@ -23,20 +23,6 @@ module Selenium
23
23
  autoload :Driver, 'selenium/webdriver/ie/driver'
24
24
  autoload :Options, 'selenium/webdriver/ie/options'
25
25
  autoload :Service, 'selenium/webdriver/ie/service'
26
-
27
- def self.driver_path=(path)
28
- WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path=',
29
- 'Selenium::WebDriver::IE::Service#driver_path=',
30
- id: :driver_path
31
- Selenium::WebDriver::IE::Service.driver_path = path
32
- end
33
-
34
- def self.driver_path
35
- WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path',
36
- 'Selenium::WebDriver::IE::Service#driver_path',
37
- id: :driver_path
38
- Selenium::WebDriver::IE::Service.driver_path
39
- end
40
26
  end # IE
41
27
  end # WebDriver
42
28
  end # Selenium
@@ -29,7 +29,6 @@ module Selenium
29
29
  class Driver < WebDriver::Driver
30
30
  include DriverExtensions::UploadsFiles
31
31
  include DriverExtensions::HasSessionId
32
- include DriverExtensions::HasRemoteStatus
33
32
 
34
33
  def initialize(bridge: nil, listener: nil, **opts)
35
34
  desired_capabilities = opts[:desired_capabilities]
@@ -53,20 +53,6 @@ module Selenium
53
53
 
54
54
  raise Error::WebDriverError, 'Unable to find Safari'
55
55
  end
56
-
57
- def driver_path=(path)
58
- WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
59
- 'Selenium::WebDriver::Safari::Service#driver_path=',
60
- id: :driver_path
61
- Selenium::WebDriver::Safari::Service.driver_path = path
62
- end
63
-
64
- def driver_path
65
- WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
66
- 'Selenium::WebDriver::Safari::Service#driver_path',
67
- id: :driver_path
68
- Selenium::WebDriver::Safari::Service.driver_path
69
- end
70
56
  end
71
57
  end # Safari
72
58
  end # WebDriver
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.2.1'
22
+ VERSION = '4.3.0'
23
23
  end # WebDriver
24
24
  end # Selenium
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-05-31 00:00:00.000000000 Z
13
+ date: 2022-06-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: childprocess
@@ -311,7 +311,6 @@ files:
311
311
  - lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb
312
312
  - lib/selenium/webdriver/common/driver_extensions/has_permissions.rb
313
313
  - lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb
314
- - lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb
315
314
  - lib/selenium/webdriver/common/driver_extensions/has_session_id.rb
316
315
  - lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb
317
316
  - lib/selenium/webdriver/common/driver_extensions/prints_page.rb
@@ -398,7 +397,6 @@ files:
398
397
  - lib/selenium/webdriver/remote/http/common.rb
399
398
  - lib/selenium/webdriver/remote/http/curb.rb
400
399
  - lib/selenium/webdriver/remote/http/default.rb
401
- - lib/selenium/webdriver/remote/http/persistent.rb
402
400
  - lib/selenium/webdriver/remote/response.rb
403
401
  - lib/selenium/webdriver/remote/server_error.rb
404
402
  - lib/selenium/webdriver/safari.rb
@@ -443,7 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
443
441
  - !ruby/object:Gem::Version
444
442
  version: 1.3.1
445
443
  requirements: []
446
- rubygems_version: 3.0.3
444
+ rubygems_version: 3.0.3.1
447
445
  signing_key:
448
446
  specification_version: 4
449
447
  summary: Selenium is a browser automation tool for automated testing of webapps and
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
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 DriverExtensions
23
- module HasRemoteStatus
24
- def remote_status
25
- WebDriver.logger.deprecate('#remote_status', '#status')
26
- @bridge.status
27
- end
28
- end # HasRemoteStatus
29
- end # DriverExtensions
30
- end # WebDriver
31
- end # Selenium
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
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
- require 'net/http/persistent'
21
-
22
- module Selenium
23
- module WebDriver
24
- module Remote
25
- module Http
26
- # @api private
27
- class Persistent < Default
28
- def initialize(open_timeout: nil, read_timeout: nil)
29
- WebDriver.logger.deprecate("Selenium::WebDriver::Remote::Http::Persistent",
30
- id: :http_persistent) { "The default HTTP client now uses persistence." }
31
- super
32
- end
33
-
34
- def close
35
- @http&.shutdown
36
- end
37
-
38
- private
39
-
40
- def start(*)
41
- # no need to explicitly start connection
42
- end
43
-
44
- def new_http_client
45
- proxy = nil
46
-
47
- if @proxy
48
- unless @proxy.respond_to?(:http)
49
- url = @proxy.http
50
- raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}" unless url
51
- end
52
- proxy = URI.parse(url)
53
- end
54
-
55
- Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
56
- end
57
-
58
- def response_for(request)
59
- http.request server_url, request
60
- end
61
- end # Persistent
62
- end # Http
63
- end # Remote
64
- end # WebDriver
65
- end # Selenium