selenium-webdriver 4.4.0 → 4.6.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: 2be9fb14d69ce82170e3ddbe0cbcf2f2428e1978544d8a7c11191ebd37cf0241
4
- data.tar.gz: 2e40d6ad67ccfb269ee1ae9d3f47d024e90081da9881f757f22170751875fa69
3
+ metadata.gz: e26709ed8eff25ea2f42b168dcfd31e5442cdf339e31dce86d185aefa69696fb
4
+ data.tar.gz: b3abfb660496c0abe31e37a9974009aed303c9f2adf34a97b87d3d407140cd4b
5
5
  SHA512:
6
- metadata.gz: b7f419d9b1349a1afbf68999eecaa53391503cc793026228577fbcb40ac4958a35c539286f7c4c3c913992336dc797481f7c57f6aec9d58813671e24d1cd09ad
7
- data.tar.gz: '0093bd2d0fbb0c1c8e7abee9d1a632f80d458b1dc0d1b22635f403230ed7c40a2be498915d8abed40bd4992295a1444a69c3e653ebf1d4cf106886c8a9d5a499'
6
+ metadata.gz: 7c47931633f1892c3021fa1f97cc57fabed2633255a6eb18afe7bc1ac72742272bca354b677902f4afa38a6cc0b51126c895a58c391b25458ec722233729136a
7
+ data.tar.gz: 2960736aba4dd64aa5b98444f0ca6d7478c7a9d8a4bc5c5a44d7579acf62f4971d50c109c8d5769fea53aebe11c574291a232f5042ec33213eb5d21761252db0
data/CHANGES CHANGED
@@ -1,4 +1,37 @@
1
- 4.4.0 (Unreleased)
1
+ 4.6.0 (2022-11-04)
2
+ =========================
3
+ BiDi:
4
+ * Released selenium-devtools 0.107.0 (supports CDP v85, v105, v106, v107)
5
+
6
+ Ruby:
7
+ * firefox scroll by amount is only failing on mac
8
+ * add initial support for selenium manager
9
+ * Revert "[rb] do not allow Select class to work with disabled selects"
10
+ * Make sure selenium-manager is packed into gem
11
+ * Fix platform list in #scroll_by guard
12
+
13
+
14
+ 4.5.0 (2022-09-28)
15
+ =========================
16
+
17
+ BiDi:
18
+ * Released selenium-devtools 0.105.0 (supports CDP v85, v103, v104, v105)
19
+ * Released selenium-devtools 0.106.0 (supports CDP v85, v104, v105, v106)
20
+ * Add HasBiDi support to Chrome
21
+
22
+ Ruby:
23
+ * Fix bug in Platform code
24
+ * Update Select class to error when elements are disabled (#10812)
25
+
26
+ Firefox:
27
+ * Add support for installing unsigned add-ons (#10265, thanks TamsilAmani!)
28
+ * Change accept_insecure_certificates to true by default (to match other bindings)
29
+ * Set debugger_address option to true by default
30
+
31
+ Server:
32
+ * Add support for initializing server class with arguments and log level
33
+
34
+ 4.4.0 (2022-08-09)
2
35
  =========================
3
36
 
4
37
  BiDi:
Binary file
Binary file
Binary file
@@ -182,15 +182,21 @@ module Selenium
182
182
  def initialize(jar, opts = {})
183
183
  raise Errno::ENOENT, jar unless File.exist?(jar)
184
184
 
185
- @jar = jar
186
- @host = '127.0.0.1'
187
- @role = opts.fetch(:role, 'standalone')
188
- @port = opts.fetch(:port, 4444)
189
- @timeout = opts.fetch(:timeout, 30)
185
+ @jar = jar
186
+ @host = '127.0.0.1'
187
+ @role = opts.fetch(:role, 'standalone')
188
+ @port = opts.fetch(:port, 4444)
189
+ @timeout = opts.fetch(:timeout, 30)
190
190
  @background = opts.fetch(:background, false)
191
- @log = opts[:log]
192
- @log_file = nil
193
- @additional_args = []
191
+ @additional_args = opts.fetch(:args, [])
192
+ @log = opts[:log]
193
+ if opts[:log_level]
194
+ @log ||= true
195
+ @additional_args << '--log-level'
196
+ @additional_args << opts[:log_level].to_s
197
+ end
198
+
199
+ @log_file = nil
194
200
  end
195
201
 
196
202
  def start
@@ -28,6 +28,7 @@ module Selenium
28
28
 
29
29
  class Driver < WebDriver::Driver
30
30
  EXTENSIONS = [DriverExtensions::HasCDP,
31
+ DriverExtensions::HasBiDi,
31
32
  DriverExtensions::HasCasting,
32
33
  DriverExtensions::HasNetworkConditions,
33
34
  DriverExtensions::HasNetworkInterception,
@@ -26,7 +26,7 @@ module Selenium
26
26
  MISSING_TEXT = <<~ERROR
27
27
  Unable to find chromedriver. Please download the server from
28
28
  https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
29
- More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
29
+ More info at https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/?language=ruby.
30
30
  ERROR
31
31
  SHUTDOWN_SUPPORTED = true
32
32
 
@@ -101,7 +101,7 @@ module Selenium
101
101
  # if it exists. If it does not, then the value of the attribute with the given name is returned.
102
102
  # If neither exists, null is returned.
103
103
  #
104
- # The "style" attribute is converted as best can be to a text representation with a trailing semi-colon.
104
+ # The "style" attribute is converted as best can be to a text representation with a trailing semicolon.
105
105
  #
106
106
  # The following are deemed to be "boolean" attributes, and will return either "true" or "false":
107
107
  #
@@ -105,7 +105,6 @@ module Selenium
105
105
 
106
106
  def cygwin?
107
107
  RUBY_PLATFORM.include?('cygwin')
108
- !Regexp.last_match.nil?
109
108
  end
110
109
 
111
110
  def null_device
@@ -0,0 +1,86 @@
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
+ #
23
+ # Wrapper for getting information from the Selenium Manager binaries.
24
+ # This implementation is still in beta, and may change.
25
+ # @api private
26
+ #
27
+ class SeleniumManager
28
+ BIN_PATH = "../../../../../bin"
29
+
30
+ class << self
31
+ # @param [String] driver_name which driver to use.
32
+ # @return [String] the path to the correct driver.
33
+ def driver_path(driver_name)
34
+ @driver_path ||= begin
35
+ unless %w[chromedriver geckodriver msedgedriver].include?(driver_name)
36
+ msg = "Unable to locate driver with name: #{driver_name}"
37
+ raise Error::WebDriverError, msg
38
+ end
39
+
40
+ location = run("#{binary} --driver #{driver_name}").split("\t").last.strip
41
+ WebDriver.logger.debug("Driver found at #{location}")
42
+ Platform.assert_executable location
43
+
44
+ location
45
+ end
46
+ end
47
+
48
+ private
49
+
50
+ # @return [String] the path to the correct selenium manager
51
+ def binary
52
+ @binary ||= begin
53
+ path = File.expand_path(BIN_PATH, __FILE__)
54
+ path << if Platform.windows?
55
+ '/windows/selenium-manager.exe'
56
+ elsif Platform.mac?
57
+ '/macos/selenium-manager'
58
+ elsif Platform.linux?
59
+ '/linux/selenium-manager'
60
+ end
61
+ location = File.expand_path(path, __FILE__)
62
+ unless location.is_a?(String) && File.exist?(location) && File.executable?(location)
63
+ raise Error::WebDriverError, "Unable to obtain Selenium Manager"
64
+ end
65
+
66
+ WebDriver.logger.debug("Selenium Manager found at #{location}")
67
+ location
68
+ end
69
+ end
70
+
71
+ def run(command)
72
+ WebDriver.logger.debug("Executing Process #{command}")
73
+
74
+ begin
75
+ result = `#{command}`
76
+ return result if result.match?(/^INFO\t/)
77
+ rescue StandardError => e
78
+ raise Error::WebDriverError, "Unsuccessful command executed: #{command}; #{e.message}"
79
+ end
80
+
81
+ raise Error::WebDriverError, "Unsuccessful command executed: #{command}"
82
+ end
83
+ end
84
+ end # SeleniumManager
85
+ end # WebDriver
86
+ end # Selenium
@@ -80,9 +80,7 @@ module Selenium
80
80
  end
81
81
 
82
82
  def launch
83
- sm = ServiceManager.new(self)
84
- sm.start
85
- sm
83
+ ServiceManager.new(self).tap(&:start)
86
84
  end
87
85
 
88
86
  def shutdown_supported
@@ -101,6 +99,12 @@ module Selenium
101
99
  path = path.call if path.is_a?(Proc)
102
100
  path ||= Platform.find_binary(self.class::EXECUTABLE)
103
101
 
102
+ begin
103
+ path ||= SeleniumManager.driver_path(self.class::EXECUTABLE)
104
+ rescue Error::WebDriverError => e
105
+ WebDriver.logger.debug("Unable obtain driver using Selenium Manager; #{e.message}")
106
+ end
107
+
104
108
  raise Error::WebDriverError, self.class::MISSING_TEXT unless path
105
109
 
106
110
  Platform.assert_executable path
@@ -22,6 +22,7 @@ require 'selenium/webdriver/common/platform'
22
22
  require 'selenium/webdriver/common/proxy'
23
23
  require 'selenium/webdriver/common/log_entry'
24
24
  require 'selenium/webdriver/common/file_reaper'
25
+ require 'selenium/webdriver/common/selenium_manager'
25
26
  require 'selenium/webdriver/common/service'
26
27
  require 'selenium/webdriver/common/service_manager'
27
28
  require 'selenium/webdriver/common/socket_lock'
@@ -35,7 +35,11 @@ module Selenium
35
35
  end
36
36
 
37
37
  def install_addon(path, temporary)
38
- addon = File.open(path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read }
38
+ addon = if File.directory?(path)
39
+ Zipper.zip(path)
40
+ else
41
+ File.open(path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read }
42
+ end
39
43
 
40
44
  payload = {addon: addon}
41
45
  payload[:temporary] = temporary unless temporary.nil?
@@ -57,7 +57,8 @@ module Selenium
57
57
  #
58
58
 
59
59
  def initialize(log_level: nil, **opts)
60
- @debugger_address = opts.delete(:debugger_address)
60
+ @debugger_address = opts.delete(:debugger_address) { true }
61
+ opts[:accept_insecure_certs] = true unless opts.key?(:accept_insecure_certs)
61
62
 
62
63
  super(**opts)
63
64
 
@@ -215,6 +215,8 @@ module Selenium
215
215
  end
216
216
 
217
217
  def select_option(option)
218
+ raise Error::UnsupportedOperationError, 'You may not select a disabled option' unless option.enabled?
219
+
218
220
  option.click unless option.selected?
219
221
  end
220
222
 
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.4.0'
22
+ VERSION = '4.6.0'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -41,8 +41,11 @@ Gem::Specification.new do |s|
41
41
  'lib/selenium-webdriver.rb',
42
42
  'lib/selenium/server.rb',
43
43
  'lib/selenium/webdriver.rb'
44
- ] + Dir['lib/selenium/webdriver/**/*']
44
+ ]
45
+ s.files += Dir['bin/**/*']
46
+ s.files += Dir['lib/selenium/webdriver/**/*']
45
47
 
48
+ s.bindir = 'bin'
46
49
  s.require_paths = ['lib']
47
50
 
48
51
  s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 5.0']
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.4.0
4
+ version: 4.6.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-08-09 00:00:00.000000000 Z
13
+ date: 2022-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: childprocess
@@ -271,6 +271,9 @@ files:
271
271
  - LICENSE
272
272
  - NOTICE
273
273
  - README.md
274
+ - bin/linux/selenium-manager
275
+ - bin/macos/selenium-manager
276
+ - bin/windows/selenium-manager.exe
274
277
  - lib/selenium-webdriver.rb
275
278
  - lib/selenium/server.rb
276
279
  - lib/selenium/webdriver.rb
@@ -351,6 +354,7 @@ files:
351
354
  - lib/selenium/webdriver/common/profile_helper.rb
352
355
  - lib/selenium/webdriver/common/proxy.rb
353
356
  - lib/selenium/webdriver/common/search_context.rb
357
+ - lib/selenium/webdriver/common/selenium_manager.rb
354
358
  - lib/selenium/webdriver/common/service.rb
355
359
  - lib/selenium/webdriver/common/service_manager.rb
356
360
  - lib/selenium/webdriver/common/shadow_root.rb