selenium-webdriver 4.4.0 → 4.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +98 -1
  3. data/LICENSE +1 -1
  4. data/NOTICE +1 -1
  5. data/bin/linux/selenium-manager +0 -0
  6. data/bin/macos/selenium-manager +0 -0
  7. data/bin/windows/selenium-manager.exe +0 -0
  8. data/lib/selenium/server.rb +20 -16
  9. data/lib/selenium/webdriver/atoms/findElements.js +0 -0
  10. data/lib/selenium/webdriver/atoms/getAttribute.js +0 -0
  11. data/lib/selenium/webdriver/atoms/isDisplayed.js +0 -0
  12. data/lib/selenium/webdriver/atoms/mutationListener.js +0 -0
  13. data/lib/selenium/webdriver/atoms.rb +2 -3
  14. data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
  15. data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
  16. data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
  17. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
  18. data/lib/selenium/webdriver/bidi/log/filter_by.rb +40 -0
  19. data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
  20. data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
  21. data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
  22. data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
  23. data/lib/selenium/webdriver/bidi/session.rb +13 -0
  24. data/lib/selenium/webdriver/bidi.rb +3 -2
  25. data/lib/selenium/webdriver/chrome/driver.rb +19 -28
  26. data/lib/selenium/webdriver/chrome/features.rb +5 -72
  27. data/lib/selenium/webdriver/chrome/options.rb +3 -237
  28. data/lib/selenium/webdriver/chrome/profile.rb +3 -83
  29. data/lib/selenium/webdriver/chrome/service.rb +4 -19
  30. data/lib/selenium/webdriver/chromium/driver.rb +61 -0
  31. data/lib/selenium/webdriver/chromium/features.rb +103 -0
  32. data/lib/selenium/webdriver/chromium/options.rb +261 -0
  33. data/lib/selenium/webdriver/chromium/profile.rb +113 -0
  34. data/lib/selenium/webdriver/chromium/service.rb +42 -0
  35. data/lib/selenium/webdriver/chromium.rb +32 -0
  36. data/lib/selenium/webdriver/common/action_builder.rb +11 -48
  37. data/lib/selenium/webdriver/common/child_process.rb +124 -0
  38. data/lib/selenium/webdriver/common/driver.rb +39 -26
  39. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
  40. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
  41. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  42. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
  43. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
  44. data/lib/selenium/webdriver/common/driver_extensions/has_bidi.rb +0 -2
  45. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +0 -1
  46. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
  47. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +0 -2
  48. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
  49. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
  50. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
  51. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +1 -2
  52. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +0 -1
  53. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
  54. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +0 -2
  55. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
  56. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +0 -2
  57. data/lib/selenium/webdriver/common/element.rb +7 -7
  58. data/lib/selenium/webdriver/common/error.rb +0 -2
  59. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
  60. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +3 -3
  61. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +2 -2
  62. data/lib/selenium/webdriver/common/interactions/scroll.rb +7 -5
  63. data/lib/selenium/webdriver/common/logger.rb +10 -2
  64. data/lib/selenium/webdriver/common/options.rb +30 -8
  65. data/lib/selenium/webdriver/common/platform.rb +4 -1
  66. data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
  67. data/lib/selenium/webdriver/common/proxy.rb +1 -1
  68. data/lib/selenium/webdriver/common/selenium_manager.rb +89 -0
  69. data/lib/selenium/webdriver/common/service.rb +16 -8
  70. data/lib/selenium/webdriver/common/service_manager.rb +2 -10
  71. data/lib/selenium/webdriver/common/shadow_root.rb +1 -2
  72. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  73. data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
  74. data/lib/selenium/webdriver/common/target_locator.rb +2 -3
  75. data/lib/selenium/webdriver/common/timeouts.rb +2 -2
  76. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +8 -6
  77. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +0 -1
  78. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +16 -16
  79. data/lib/selenium/webdriver/common/websocket_connection.rb +10 -2
  80. data/lib/selenium/webdriver/common.rb +2 -0
  81. data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
  82. data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
  83. data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
  84. data/lib/selenium/webdriver/devtools/network_interceptor.rb +3 -6
  85. data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
  86. data/lib/selenium/webdriver/devtools/request.rb +0 -2
  87. data/lib/selenium/webdriver/devtools/response.rb +0 -2
  88. data/lib/selenium/webdriver/devtools.rb +0 -1
  89. data/lib/selenium/webdriver/edge/driver.rb +20 -3
  90. data/lib/selenium/webdriver/edge/features.rb +3 -4
  91. data/lib/selenium/webdriver/edge/options.rb +3 -5
  92. data/lib/selenium/webdriver/edge/profile.rb +2 -2
  93. data/lib/selenium/webdriver/edge/service.rb +2 -2
  94. data/lib/selenium/webdriver/firefox/driver.rb +19 -2
  95. data/lib/selenium/webdriver/firefox/features.rb +5 -2
  96. data/lib/selenium/webdriver/firefox/options.rb +6 -2
  97. data/lib/selenium/webdriver/firefox/profile.rb +6 -6
  98. data/lib/selenium/webdriver/firefox/service.rb +0 -1
  99. data/lib/selenium/webdriver/ie/driver.rb +20 -1
  100. data/lib/selenium/webdriver/ie/service.rb +1 -2
  101. data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +0 -2
  102. data/lib/selenium/webdriver/remote/bridge.rb +9 -15
  103. data/lib/selenium/webdriver/remote/capabilities.rb +34 -12
  104. data/lib/selenium/webdriver/remote/driver.rb +13 -13
  105. data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
  106. data/lib/selenium/webdriver/remote/http/default.rb +1 -0
  107. data/lib/selenium/webdriver/remote/response.rb +0 -1
  108. data/lib/selenium/webdriver/remote.rb +0 -1
  109. data/lib/selenium/webdriver/safari/driver.rb +20 -1
  110. data/lib/selenium/webdriver/safari/features.rb +0 -2
  111. data/lib/selenium/webdriver/safari/options.rb +5 -1
  112. data/lib/selenium/webdriver/safari.rb +1 -1
  113. data/lib/selenium/webdriver/support/color.rb +15 -15
  114. data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
  115. data/lib/selenium/webdriver/support/guards/guard_condition.rb +0 -2
  116. data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
  117. data/lib/selenium/webdriver/support/select.rb +3 -1
  118. data/lib/selenium/webdriver/version.rb +1 -1
  119. data/lib/selenium/webdriver.rb +3 -4
  120. data/selenium-webdriver.gemspec +8 -9
  121. metadata +31 -74
  122. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
  123. data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
@@ -20,14 +20,12 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Remote
23
-
24
23
  #
25
24
  # Specification of the desired and/or actual capabilities of the browser that the
26
25
  # server is being asked to create.
27
26
  #
28
27
 
29
28
  class Capabilities
30
-
31
29
  KNOWN = [
32
30
  :browser_name,
33
31
  :browser_version,
@@ -59,10 +57,25 @@ module Selenium
59
57
  # Backward compatibility
60
58
  #
61
59
 
62
- alias_method :version, :browser_version
63
- alias_method :version=, :browser_version=
64
- alias_method :platform, :platform_name
65
- alias_method :platform=, :platform_name=
60
+ def version
61
+ WebDriver.logger.deprecate('`Capabilities#version`', '`Capabilities#browser_version`', id: :jwp_caps)
62
+ browser_version
63
+ end
64
+
65
+ def version=(value)
66
+ WebDriver.logger.deprecate('`Capabilities#version=`', '`Capabilities#browser_version=`', id: :jwp_caps)
67
+ self.browser_version = value
68
+ end
69
+
70
+ def platform
71
+ WebDriver.logger.deprecate('`Capabilities#platform`', '`Capabilities#platform_name`', id: :jwp_caps)
72
+ platform_name
73
+ end
74
+
75
+ def platform=(value)
76
+ WebDriver.logger.deprecate('`Capabilities#platform=`', '`Capabilities#platform_name=`', id: :jwp_caps)
77
+ self.platform_name = value
78
+ end
66
79
 
67
80
  #
68
81
  # Convenience methods for the common choices.
@@ -70,44 +83,52 @@ module Selenium
70
83
 
71
84
  class << self
72
85
  def chrome(opts = {})
86
+ WebDriver.logger.deprecate('Remote::Capabilities.chrome', 'Options.chrome', id: :caps_browsers)
73
87
  new({
74
88
  browser_name: 'chrome'
75
89
  }.merge(opts))
76
90
  end
77
91
 
78
92
  def edge(opts = {})
93
+ WebDriver.logger.deprecate('Remote::Capabilities.edge', 'Options.edge', id: :caps_browsers)
79
94
  new({
80
95
  browser_name: 'MicrosoftEdge'
81
96
  }.merge(opts))
82
97
  end
83
- alias_method :microsoftedge, :edge
98
+ alias microsoftedge edge
84
99
 
85
100
  def firefox(opts = {})
101
+ WebDriver.logger.deprecate('Remote::Capabilities.firefox', 'Options.firefox', id: :caps_browsers)
86
102
  new({
87
103
  browser_name: 'firefox'
88
104
  }.merge(opts))
89
105
  end
90
- alias_method :ff, :firefox
106
+ alias ff firefox
91
107
 
92
108
  def safari(opts = {})
109
+ WebDriver.logger.deprecate('Remote::Capabilities.safari', 'Options.safari', id: :caps_browsers)
93
110
  new({
94
- browser_name: Selenium::WebDriver::Safari.technology_preview? ? "Safari Technology Preview" : 'safari'
111
+ browser_name: Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
95
112
  }.merge(opts))
96
113
  end
97
114
 
98
115
  def htmlunit(opts = {})
116
+ WebDriver.logger.deprecate('Remote::Capabilities.htmlunit',
117
+ 'as argument in constructor',
118
+ id: :caps_browsers)
99
119
  new({
100
120
  browser_name: 'htmlunit'
101
121
  }.merge(opts))
102
122
  end
103
123
 
104
124
  def internet_explorer(opts = {})
125
+ WebDriver.logger.deprecate('Remote::Capabilities.ie', 'Options.ie', id: :caps_browsers)
105
126
  new({
106
127
  browser_name: 'internet explorer',
107
128
  platform_name: :windows
108
129
  }.merge(opts))
109
130
  end
110
- alias_method :ie, :internet_explorer
131
+ alias ie internet_explorer
111
132
 
112
133
  def always_match(capabilities)
113
134
  new(always_match: capabilities)
@@ -134,7 +155,8 @@ module Selenium
134
155
 
135
156
  # Remote Server Specific
136
157
  if data.key?('webdriver.remote.sessionid')
137
- caps[:remote_session_id] = data.delete('webdriver.remote.sessionid')
158
+ caps[:remote_session_id] =
159
+ data.delete('webdriver.remote.sessionid')
138
160
  end
139
161
 
140
162
  KNOWN.each do |cap|
@@ -269,7 +291,7 @@ module Selenium
269
291
  as_json == other.as_json
270
292
  end
271
293
 
272
- alias_method :eql?, :==
294
+ alias eql? ==
273
295
 
274
296
  protected
275
297
 
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Remote
23
-
24
23
  #
25
24
  # Driver implementation for remote server.
26
25
  # @api private
@@ -30,17 +29,12 @@ module Selenium
30
29
  include DriverExtensions::UploadsFiles
31
30
  include DriverExtensions::HasSessionId
32
31
 
33
- def initialize(bridge: nil, listener: nil, **opts)
34
- desired_capabilities = opts[:desired_capabilities]
35
- if desired_capabilities.is_a?(Symbol)
36
- unless Remote::Capabilities.respond_to?(desired_capabilities)
37
- raise Error::WebDriverError, "invalid desired capability: #{desired_capabilities.inspect}"
38
- end
39
-
40
- opts[:desired_capabilities] = Remote::Capabilities.__send__(desired_capabilities)
41
- end
42
- opts[:url] ||= "http://#{Platform.localhost}:4444/wd/hub"
43
- super
32
+ def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
33
+ raise ArgumentError, "Can not set :service object on #{self.class}" if service
34
+
35
+ url ||= "http://#{Platform.localhost}:4444/wd/hub"
36
+ caps = process_options(options, capabilities)
37
+ super(caps: caps, url: url, **opts)
44
38
  @bridge.file_detector = ->((filename, *)) { File.exist?(filename) && filename.to_s }
45
39
  end
46
40
 
@@ -52,7 +46,13 @@ module Selenium
52
46
 
53
47
  def devtools_version
54
48
  capabilities['se:cdpVersion']&.split('.')&.first ||
55
- raise(Error::WebDriverError, "DevTools is not supported by the Remote Server")
49
+ raise(Error::WebDriverError, 'DevTools is not supported by the Remote Server')
50
+ end
51
+
52
+ def process_options(options, capabilities)
53
+ raise ArgumentError, "#{self.class} needs :options to be set" if options.nil? && capabilities.nil?
54
+
55
+ super(options, capabilities)
56
56
  end
57
57
  end # Driver
58
58
  end # Remote
@@ -22,7 +22,6 @@ require 'curb'
22
22
  module Selenium
23
23
  module WebDriver
24
24
  module Remote
25
-
26
25
  module Http
27
26
  #
28
27
  # An alternative to the default Net::HTTP client.
@@ -38,7 +37,6 @@ module Selenium
38
37
  #
39
38
 
40
39
  class Curb < Common
41
-
42
40
  def quit_errors
43
41
  [Curl::Err::RecvError] + super
44
42
  end
@@ -100,6 +100,7 @@ module Selenium
100
100
 
101
101
  request(:get, URI.parse(response['Location']), DEFAULT_HEADERS.dup, nil, redirects + 1)
102
102
  else
103
+ WebDriver.logger.debug(" <<< #{response.instance_variable_get(:@header).inspect}")
103
104
  create_response response.code, response.body, response.content_type
104
105
  end
105
106
  end
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Remote
23
-
24
23
  #
25
24
  # @api private
26
25
  #
@@ -27,7 +27,6 @@ module Selenium
27
27
  autoload :Driver, 'selenium/webdriver/remote/driver'
28
28
  autoload :Response, 'selenium/webdriver/remote/response'
29
29
  autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
30
- autoload :COMMANDS, 'selenium/webdriver/remote/commands'
31
30
 
32
31
  module Http
33
32
  autoload :Common, 'selenium/webdriver/remote/http/common'
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Safari
23
-
24
23
  #
25
24
  # Driver implementation for Safari.
26
25
  # @api private
@@ -31,9 +30,29 @@ module Selenium
31
30
  DriverExtensions::HasApplePermissions,
32
31
  DriverExtensions::HasWebStorage].freeze
33
32
 
33
+ def initialize(capabilities: nil, options: nil, service: nil, url: nil, **opts)
34
+ raise ArgumentError, "Can't initialize #{self.class} with :url" if url
35
+
36
+ caps = process_options(options, capabilities)
37
+ url = service_url(service || Service.safari)
38
+ super(caps: caps, url: url, **opts)
39
+ end
40
+
34
41
  def browser
35
42
  :safari
36
43
  end
44
+
45
+ private
46
+
47
+ def process_options(options, capabilities)
48
+ if options && !options.is_a?(Options)
49
+ raise ArgumentError, ":options must be an instance of #{Options}"
50
+ elsif options.nil? && capabilities.nil?
51
+ options = Options.new
52
+ end
53
+
54
+ super(options, capabilities)
55
+ end
37
56
  end # Driver
38
57
  end # Safari
39
58
  end # WebDriver
@@ -21,7 +21,6 @@ module Selenium
21
21
  module WebDriver
22
22
  module Safari
23
23
  module Features
24
-
25
24
  # https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
26
25
  SAFARI_COMMANDS = {
27
26
  get_permissions: [:get, 'session/:session_id/apple/permissions'],
@@ -44,7 +43,6 @@ module Selenium
44
43
  def attach_debugger
45
44
  execute :attach_debugger, {}, {}
46
45
  end
47
-
48
46
  end # Bridge
49
47
  end # Safari
50
48
  end # WebDriver
@@ -26,7 +26,7 @@ module Selenium
26
26
  # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
27
27
  CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',
28
28
  automatic_profiling: 'safari:automaticProfiling'}.freeze
29
- BROWSER = 'safari'
29
+ BROWSER = Selenium::WebDriver::Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
30
30
 
31
31
  def add_option(name, value = nil)
32
32
  key = name.is_a?(Hash) ? name.keys.first : name
@@ -35,6 +35,10 @@ module Selenium
35
35
  super
36
36
  end
37
37
 
38
+ def as_json(*)
39
+ @options[:browser_name] = Safari.technology_preview? ? 'Safari Technology Preview' : 'safari'
40
+ super
41
+ end
38
42
  end # Options
39
43
  end # Safari
40
44
  end # WebDriver
@@ -29,7 +29,7 @@ module Selenium
29
29
  attr_accessor :use_technology_preview
30
30
 
31
31
  def technology_preview
32
- "/Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver"
32
+ '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver'
33
33
  end
34
34
 
35
35
  def technology_preview!
@@ -21,29 +21,29 @@ module Selenium
21
21
  module WebDriver
22
22
  module Support
23
23
  class Color
24
- RGB_PATTERN = %r{^\s*rgb\(\s*(\d{1,3})\s*,
24
+ RGB_PATTERN = /^\s*rgb\(\s*(\d{1,3})\s*,
25
25
  \s*(\d{1,3})\s*,
26
- \s*(\d{1,3})\s*\)\s*$}x.freeze
27
- RGB_PCT_PATTERN = %r{^\s*rgb\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
26
+ \s*(\d{1,3})\s*\)\s*$/x.freeze
27
+ RGB_PCT_PATTERN = /^\s*rgb\(\s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
28
28
  \s*(\d{1,3}|\d{1,2}\.\d+)%\s*,
29
- \s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$}x.freeze
30
- RGBA_PATTERN = %r{^\s*rgba\(\s*(\d{1,3})\s*,
29
+ \s*(\d{1,3}|\d{1,2}\.\d+)%\s*\)\s*$/x.freeze
30
+ RGBA_PATTERN = /^\s*rgba\(\s*(\d{1,3})\s*,
31
31
  \s*(\d{1,3})\s*,
32
32
  \s*(\d{1,3})\s*,
33
- \s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
34
- RGBA_PCT_PATTERN = %r{^\s*rgba\(\s*(\d{1,3}|\d{1,2}\.\d+)
33
+ \s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
34
+ RGBA_PCT_PATTERN = /^\s*rgba\(\s*(\d{1,3}|\d{1,2}\.\d+)
35
35
  %\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
36
36
  %\s*,\s*(\d{1,3}|\d{1,2}\.\d+)
37
- %\s*,\s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
37
+ %\s*,\s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
38
38
  HEX_PATTERN = /#(\h{2})(\h{2})(\h{2})/.freeze
39
39
  HEX3_PATTERN = /#(\h)(\h)(\h)/.freeze
40
- HSL_PATTERN = %r{^\s*hsl\(\s*(\d{1,3})\s*,
40
+ HSL_PATTERN = /^\s*hsl\(\s*(\d{1,3})\s*,
41
41
  \s*(\d{1,3})%\s*,
42
- \s*(\d{1,3})%\s*\)\s*$}x.freeze
43
- HSLA_PATTERN = %r{^\s*hsla\(\s*(\d{1,3})\s*,
42
+ \s*(\d{1,3})%\s*\)\s*$/x.freeze
43
+ HSLA_PATTERN = /^\s*hsla\(\s*(\d{1,3})\s*,
44
44
  \s*(\d{1,3})%\s*,
45
45
  \s*(\d{1,3})%\s*,
46
- \s*(0|1|0\.\d+)\s*\)\s*$}x.freeze
46
+ \s*(0|1|0\.\d+)\s*\)\s*$/x.freeze
47
47
 
48
48
  attr_reader :red, :green, :blue, :alpha
49
49
 
@@ -83,8 +83,8 @@ module Selenium
83
83
  g = r
84
84
  b = r
85
85
  else
86
- luminocity2 = l < 0.5 ? l * (1 + s) : l + s - (l * s)
87
- luminocity1 = (2 * l) - luminocity2
86
+ luminocity2 = l < 0.5 ? l * (s + 1) : l + s - (l * s)
87
+ luminocity1 = (l * 2) - luminocity2
88
88
 
89
89
  r = hue_to_rgb(luminocity1, luminocity2, h + (1.0 / 3.0))
90
90
  g = hue_to_rgb(luminocity1, luminocity2, h)
@@ -122,7 +122,7 @@ module Selenium
122
122
 
123
123
  [red, green, blue, alpha] == [other.red, other.green, other.blue, other.alpha]
124
124
  end
125
- alias_method :eql?, :==
125
+ alias eql? ==
126
126
 
127
127
  def hash
128
128
  [red, green, blue, alpha, self.class].hash
@@ -21,14 +21,12 @@ module Selenium
21
21
  module WebDriver
22
22
  module Support
23
23
  class Guards
24
-
25
24
  #
26
25
  # Guard derived from RSpec example metadata.
27
26
  # @api private
28
27
  #
29
28
 
30
29
  class Guard
31
-
32
30
  attr_reader :guarded, :type, :messages, :reason
33
31
 
34
32
  def initialize(guarded, type, guards = nil)
@@ -21,7 +21,6 @@ module Selenium
21
21
  module WebDriver
22
22
  module Support
23
23
  class Guards
24
-
25
24
  #
26
25
  # Guard derived from RSpec example metadata.
27
26
  # @api private
@@ -44,7 +43,6 @@ module Selenium
44
43
 
45
44
  list.empty? || @execution.call(list)
46
45
  end
47
-
48
46
  end # GuardCondition
49
47
  end # Guards
50
48
  end # Support
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Support
23
-
24
23
  #
25
24
  # @api private
26
25
  #
@@ -86,7 +86,7 @@ module Selenium
86
86
  #
87
87
  # <option value="foo">Bar</option>
88
88
  #
89
- # When slecting by :value, selects all options that have a value matching the argument. That is, when given "foo" this
89
+ # When selecting by :value, selects all options that have a value matching the argument. That is, when given "foo" this
90
90
  # would select an option like:
91
91
  #
92
92
  # <option value="foo">Bar</option>
@@ -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.8.1'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -17,7 +17,6 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- require 'childprocess'
21
20
  require 'tmpdir'
22
21
  require 'fileutils'
23
22
  require 'date'
@@ -34,9 +33,9 @@ module Selenium
34
33
  Point = Struct.new(:x, :y)
35
34
  Dimension = Struct.new(:width, :height)
36
35
  Rectangle = Struct.new(:x, :y, :width, :height)
37
- Location = Struct.new(:latitude, :longitude, :altitude)
38
36
 
39
37
  autoload :BiDi, 'selenium/webdriver/bidi'
38
+ autoload :Chromium, 'selenium/webdriver/chromium'
40
39
  autoload :Chrome, 'selenium/webdriver/chrome'
41
40
  autoload :DevTools, 'selenium/webdriver/devtools'
42
41
  autoload :Edge, 'selenium/webdriver/edge'
@@ -95,8 +94,8 @@ module Selenium
95
94
  # @return [Logger]
96
95
  #
97
96
 
98
- def self.logger
99
- @logger ||= WebDriver::Logger.new
97
+ def self.logger(**opts)
98
+ @logger ||= WebDriver::Logger.new('Selenium', **opts)
100
99
  end
101
100
  end # WebDriver
102
101
  end # Selenium
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.homepage = 'https://selenium.dev'
25
25
  s.metadata = {
26
26
  'changelog_uri' => 'https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES',
27
+ 'github_repo' => 'ssh://github.com/SeleniumHQ/selenium',
27
28
  'source_code_uri' => 'https://github.com/SeleniumHQ/selenium/tree/trunk/rb',
28
29
  'rubygems_mfa_required' => 'true'
29
30
  }
@@ -41,25 +42,23 @@ Gem::Specification.new do |s|
41
42
  'lib/selenium-webdriver.rb',
42
43
  'lib/selenium/server.rb',
43
44
  'lib/selenium/webdriver.rb'
44
- ] + Dir['lib/selenium/webdriver/**/*']
45
+ ]
46
+ s.files += Dir['bin/**/*']
47
+ s.files += Dir['lib/selenium/webdriver/**/*']
45
48
 
49
+ s.bindir = 'bin'
46
50
  s.require_paths = ['lib']
47
51
 
48
- s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 5.0']
49
52
  s.add_runtime_dependency 'rexml', ['~> 3.2', '>= 3.2.5']
50
53
  s.add_runtime_dependency 'rubyzip', ['>= 1.2.2', '< 3.0']
51
54
  s.add_runtime_dependency 'websocket', ['~> 1.0']
52
55
 
53
- # childprocess requires ffi on windows but doesn't declare it in its dependencies
54
- s.add_development_dependency 'ffi'
55
56
  s.add_development_dependency 'pry', ['~> 0.14']
56
57
  s.add_development_dependency 'rack', ['~> 2.0']
57
- s.add_development_dependency 'rake'
58
58
  s.add_development_dependency 'rspec', ['~> 3.0']
59
- s.add_development_dependency 'rubocop', ['~> 1.31']
60
- s.add_development_dependency 'rubocop-performance', ['~> 1.13']
61
- s.add_development_dependency 'rubocop-rake'
62
- s.add_development_dependency 'rubocop-rspec', ['~> 2.12']
59
+ s.add_development_dependency 'rubocop', ['~> 1.42']
60
+ s.add_development_dependency 'rubocop-performance', ['~> 1.15']
61
+ s.add_development_dependency 'rubocop-rspec', ['~> 2.16']
63
62
  s.add_development_dependency 'webmock', ['~> 3.5']
64
63
  s.add_development_dependency 'webrick', ['~> 1.7']
65
64
  s.add_development_dependency 'yard', ['~> 0.9.11']