selenium-webdriver 3.141.0 → 3.141.592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +78 -0
  3. data/Gemfile +2 -0
  4. data/LICENSE +1 -1
  5. data/lib/selenium-webdriver.rb +2 -0
  6. data/lib/selenium/server.rb +9 -7
  7. data/lib/selenium/webdriver.rb +3 -1
  8. data/lib/selenium/webdriver/atoms.rb +20 -1
  9. data/lib/selenium/webdriver/atoms/getAttribute.js +6 -7
  10. data/lib/selenium/webdriver/atoms/isDisplayed.js +60 -59
  11. data/lib/selenium/webdriver/chrome.rb +10 -4
  12. data/lib/selenium/webdriver/chrome/bridge.rb +5 -3
  13. data/lib/selenium/webdriver/chrome/driver.rb +10 -13
  14. data/lib/selenium/webdriver/chrome/options.rb +4 -4
  15. data/lib/selenium/webdriver/chrome/profile.rb +4 -3
  16. data/lib/selenium/webdriver/chrome/service.rb +13 -13
  17. data/lib/selenium/webdriver/common.rb +4 -2
  18. data/lib/selenium/webdriver/common/action_builder.rb +2 -0
  19. data/lib/selenium/webdriver/common/alert.rb +2 -0
  20. data/lib/selenium/webdriver/common/bridge_helper.rb +8 -5
  21. data/lib/selenium/webdriver/common/driver.rb +22 -7
  22. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +2 -0
  23. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +2 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +2 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +3 -3
  26. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +2 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +3 -1
  28. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +2 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -0
  30. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +2 -0
  32. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -0
  33. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +3 -1
  34. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -0
  35. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -3
  36. data/lib/selenium/webdriver/common/element.rb +3 -1
  37. data/lib/selenium/webdriver/common/error.rb +74 -18
  38. data/lib/selenium/webdriver/common/file_reaper.rb +3 -3
  39. data/lib/selenium/webdriver/common/html5/local_storage.rb +2 -0
  40. data/lib/selenium/webdriver/common/html5/session_storage.rb +2 -0
  41. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +4 -1
  42. data/lib/selenium/webdriver/common/interactions/input_device.rb +3 -0
  43. data/lib/selenium/webdriver/common/interactions/interaction.rb +3 -0
  44. data/lib/selenium/webdriver/common/interactions/interactions.rb +3 -1
  45. data/lib/selenium/webdriver/common/interactions/key_actions.rb +2 -0
  46. data/lib/selenium/webdriver/common/interactions/key_input.rb +4 -0
  47. data/lib/selenium/webdriver/common/interactions/none_input.rb +3 -0
  48. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +2 -0
  49. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +7 -0
  50. data/lib/selenium/webdriver/common/keyboard.rb +4 -1
  51. data/lib/selenium/webdriver/common/keys.rb +3 -0
  52. data/lib/selenium/webdriver/common/log_entry.rb +4 -2
  53. data/lib/selenium/webdriver/common/logger.rb +15 -40
  54. data/lib/selenium/webdriver/common/logs.rb +2 -0
  55. data/lib/selenium/webdriver/common/manager.rb +177 -0
  56. data/lib/selenium/webdriver/common/mouse.rb +3 -0
  57. data/lib/selenium/webdriver/common/navigation.rb +2 -0
  58. data/lib/selenium/webdriver/common/options.rb +26 -0
  59. data/lib/selenium/webdriver/common/platform.rb +26 -30
  60. data/lib/selenium/webdriver/common/port_prober.rb +6 -19
  61. data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
  62. data/lib/selenium/webdriver/common/proxy.rb +13 -5
  63. data/lib/selenium/webdriver/common/search_context.rb +4 -6
  64. data/lib/selenium/webdriver/common/service.rb +74 -29
  65. data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
  66. data/lib/selenium/webdriver/common/socket_poller.rb +45 -48
  67. data/lib/selenium/webdriver/common/target_locator.rb +6 -4
  68. data/lib/selenium/webdriver/common/timeouts.rb +2 -0
  69. data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
  70. data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
  71. data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
  72. data/lib/selenium/webdriver/common/w3c_manager.rb +45 -0
  73. data/lib/selenium/webdriver/common/w3c_options.rb +2 -0
  74. data/lib/selenium/webdriver/common/wait.rb +11 -3
  75. data/lib/selenium/webdriver/common/window.rb +2 -0
  76. data/lib/selenium/webdriver/common/zipper.rb +3 -3
  77. data/lib/selenium/webdriver/edge.rb +11 -5
  78. data/lib/selenium/webdriver/edge/bridge.rb +2 -0
  79. data/lib/selenium/webdriver/edge/driver.rb +5 -12
  80. data/lib/selenium/webdriver/edge/options.rb +3 -0
  81. data/lib/selenium/webdriver/edge/service.rb +8 -12
  82. data/lib/selenium/webdriver/firefox.rb +10 -4
  83. data/lib/selenium/webdriver/firefox/binary.rb +7 -6
  84. data/lib/selenium/webdriver/firefox/bridge.rb +47 -0
  85. data/lib/selenium/webdriver/firefox/driver.rb +3 -2
  86. data/lib/selenium/webdriver/firefox/extension.rb +4 -4
  87. data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
  88. data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
  89. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
  90. data/lib/selenium/webdriver/firefox/marionette/driver.rb +5 -11
  91. data/lib/selenium/webdriver/firefox/options.rb +3 -1
  92. data/lib/selenium/webdriver/firefox/profile.rb +7 -8
  93. data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
  94. data/lib/selenium/webdriver/firefox/service.rb +8 -19
  95. data/lib/selenium/webdriver/firefox/util.rb +2 -0
  96. data/lib/selenium/webdriver/ie.rb +10 -4
  97. data/lib/selenium/webdriver/ie/driver.rb +4 -10
  98. data/lib/selenium/webdriver/ie/options.rb +4 -2
  99. data/lib/selenium/webdriver/ie/service.rb +8 -12
  100. data/lib/selenium/webdriver/remote.rb +2 -0
  101. data/lib/selenium/webdriver/remote/bridge.rb +6 -4
  102. data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
  103. data/lib/selenium/webdriver/remote/commands.rb +156 -0
  104. data/lib/selenium/webdriver/remote/driver.rb +2 -0
  105. data/lib/selenium/webdriver/remote/http/common.rb +11 -4
  106. data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
  107. data/lib/selenium/webdriver/remote/http/default.rb +31 -25
  108. data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
  109. data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
  110. data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
  111. data/lib/selenium/webdriver/remote/response.rb +10 -4
  112. data/lib/selenium/webdriver/remote/server_error.rb +2 -0
  113. data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
  114. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
  115. data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
  116. data/lib/selenium/webdriver/safari.rb +11 -4
  117. data/lib/selenium/webdriver/safari/bridge.rb +5 -3
  118. data/lib/selenium/webdriver/safari/driver.rb +8 -10
  119. data/lib/selenium/webdriver/safari/options.rb +2 -0
  120. data/lib/selenium/webdriver/safari/service.rb +6 -25
  121. data/lib/selenium/webdriver/support.rb +2 -0
  122. data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
  123. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
  124. data/lib/selenium/webdriver/support/color.rb +11 -9
  125. data/lib/selenium/webdriver/support/escaper.rb +2 -0
  126. data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
  127. data/lib/selenium/webdriver/support/select.rb +19 -18
  128. data/lib/selenium/webdriver/version.rb +3 -1
  129. data/selenium-webdriver.gemspec +14 -7
  130. metadata +89 -21
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -23,27 +25,21 @@ module Selenium
23
25
  #
24
26
 
25
27
  class Service < WebDriver::Service
26
- DEFAULT_PORT = 17556
27
- @executable = 'MicrosoftWebDriver'.freeze
28
- @missing_text = <<-ERROR.gsub(/\n +| {2,}/, ' ').freeze
28
+ @default_port = 17556
29
+ @executable = 'MicrosoftWebDriver'
30
+ @missing_text = <<~ERROR
29
31
  Unable to find MicrosoftWebDriver. Please download the server from
30
32
  https://www.microsoft.com/en-us/download/details.aspx?id=48212 and place it somewhere on your PATH.
31
33
  More info at https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver.
32
34
  ERROR
35
+ @shutdown_supported = true
33
36
 
34
37
  private
35
38
 
36
- def start_process
37
- @process = build_process(@executable_path, "--port=#{@port}", *@extra_args)
38
- @process.start
39
- end
40
-
41
- def cannot_connect_error_text
42
- "unable to connect to MicrosoftWebDriver #{@host}:#{@port}"
43
- end
44
-
39
+ # Note: This processing is deprecated
45
40
  def extract_service_args(driver_opts)
46
41
  driver_args = super
42
+ driver_opts = driver_opts.dup
47
43
  driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key? :host
48
44
  driver_args << "--package=#{driver_opts[:package]}" if driver_opts.key? :package
49
45
  driver_args << "--silent" if driver_opts[:silent] == true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -32,7 +34,6 @@ require 'selenium/webdriver/firefox/legacy/driver'
32
34
  require 'selenium/webdriver/firefox/marionette/bridge'
33
35
  require 'selenium/webdriver/firefox/marionette/driver'
34
36
  require 'selenium/webdriver/firefox/options'
35
- require 'selenium/webdriver/firefox/service'
36
37
 
37
38
  module Selenium
38
39
  module WebDriver
@@ -44,12 +45,15 @@ module Selenium
44
45
  DEFAULT_LOAD_NO_FOCUS_LIB = false
45
46
 
46
47
  def self.driver_path=(path)
47
- Platform.assert_executable path
48
- @driver_path = path
48
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path=',
49
+ 'Selenium::WebDriver::Firefox::Service#driver_path='
50
+ Selenium::WebDriver::Firefox::Service.driver_path = path
49
51
  end
50
52
 
51
53
  def self.driver_path
52
- @driver_path ||= nil
54
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path',
55
+ 'Selenium::WebDriver::Firefox::Service#driver_path'
56
+ Selenium::WebDriver::Firefox::Service.driver_path
53
57
  end
54
58
 
55
59
  def self.path=(path)
@@ -58,3 +62,5 @@ module Selenium
58
62
  end # Firefox
59
63
  end # WebDriver
60
64
  end # Selenium
65
+
66
+ require 'selenium/webdriver/firefox/service'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -20,7 +22,7 @@ module Selenium
20
22
  module Firefox
21
23
  # @api private
22
24
  class Binary
23
- NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'.freeze
25
+ NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'
24
26
  NO_FOCUS_LIBRARIES = [
25
27
  ["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/amd64/#{NO_FOCUS_LIBRARY_NAME}",
26
28
  "amd64/#{NO_FOCUS_LIBRARY_NAME}"],
@@ -35,7 +37,7 @@ module Selenium
35
37
  if Platform.cygwin?
36
38
  profile_path = Platform.cygwin_path(profile_path, windows: true)
37
39
  elsif Platform.windows?
38
- profile_path = profile_path.tr('/', '\\')
40
+ profile_path = Platform.windows_path(profile_path)
39
41
  end
40
42
 
41
43
  ENV['XRE_CONSOLE_LOG'] = profile.log_file if profile.log_file
@@ -44,15 +46,14 @@ module Selenium
44
46
  ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
45
47
  ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
46
48
 
47
- if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
48
- modify_link_library_path profile_path
49
- end
49
+ modify_link_library_path profile_path if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
50
50
 
51
51
  execute(*args)
52
52
  end
53
53
 
54
54
  def quit
55
55
  return unless @process
56
+
56
57
  @process.poll_for_exit QUIT_TIMEOUT
57
58
  rescue ChildProcess::TimeoutError
58
59
  # ok, force quit
@@ -126,7 +127,7 @@ module Selenium
126
127
  raise Error::WebDriverError, "unknown platform: #{Platform.os}"
127
128
  end
128
129
 
129
- @path = Platform.cygwin_path(@path) if Platform.cygwin?
130
+ @path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
130
131
 
131
132
  unless File.file?(@path.to_s)
132
133
  error = "Could not find Firefox binary (os=#{Platform.os}). "
@@ -0,0 +1,47 @@
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 Firefox
23
+ module Bridge
24
+
25
+ COMMANDS = {
26
+ install_addon: [:post, 'session/:session_id/moz/addon/install'],
27
+ uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall']
28
+ }.freeze
29
+
30
+ def commands(command)
31
+ COMMANDS[command] || super
32
+ end
33
+
34
+ def install_addon(path, temporary)
35
+ payload = {path: path}
36
+ payload[:temporary] = temporary unless temporary.nil?
37
+ execute :install_addon, {}, payload
38
+ end
39
+
40
+ def uninstall_addon(id)
41
+ execute :uninstall_addon, {}, {id: id}
42
+ end
43
+
44
+ end # Bridge
45
+ end # Firefox
46
+ end # WebDriver
47
+ end # Selenium
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -37,8 +39,7 @@ module Selenium
37
39
  private
38
40
 
39
41
  def marionette?(opts)
40
- opts.delete(:marionette) != false &&
41
- (!opts[:desired_capabilities] || opts[:desired_capabilities][:marionette] != false)
42
+ opts.delete(:marionette) != false && (opts.dig(:desired_capabilities, :marionette) != false)
42
43
  end
43
44
  end
44
45
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -23,12 +25,10 @@ module Selenium
23
25
  #
24
26
 
25
27
  class Extension
26
- NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'.freeze
28
+ NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'
27
29
 
28
30
  def initialize(path)
29
- unless File.exist?(path)
30
- raise Error::WebDriverError, "could not find extension at #{path.inspect}"
31
- end
31
+ raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.exist?(path)
32
32
 
33
33
  @path = path
34
34
  @should_reap_root = false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -82,6 +84,7 @@ module Selenium
82
84
  poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT)
83
85
 
84
86
  return if poller.connected?
87
+
85
88
  @binary.quit
86
89
  error = "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})"
87
90
  raise Error::WebDriverError, error
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -28,8 +30,10 @@ module Selenium
28
30
  class Driver < WebDriver::Driver
29
31
  include DriverExtensions::TakesScreenshot
30
32
 
31
- def initialize(opts = {})
32
- opts[:desired_capabilities] ||= Remote::Capabilities.firefox
33
+ def initialize(opts = {}) # rubocop:disable Metrics/AbcSize
34
+ WebDriver.logger.deprecate 'Selenium support for legacy Firefox', 'Firefox via marionette'
35
+
36
+ opts[:desired_capabilities] ||= Remote::Capabilities.firefox_legacy
33
37
 
34
38
  if opts.key? :proxy
35
39
  WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
@@ -56,7 +60,7 @@ module Selenium
56
60
  begin
57
61
  super(@bridge, listener: listener)
58
62
  rescue
59
- @launcher.quit if @launcher
63
+ @launcher&.quit
60
64
  raise
61
65
  end
62
66
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -22,8 +24,8 @@ module Selenium
22
24
  module Bridge
23
25
 
24
26
  COMMANDS = {
25
- install_addon: [:post, 'session/:session_id/moz/addon/install'.freeze],
26
- uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall'.freeze]
27
+ install_addon: [:post, 'session/:session_id/moz/addon/install'],
28
+ uninstall_addon: [:post, 'session/:session_id/moz/addon/uninstall']
27
29
  }.freeze
28
30
 
29
31
  def commands(command)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -33,15 +35,7 @@ module Selenium
33
35
  def initialize(opts = {})
34
36
  opts[:desired_capabilities] = create_capabilities(opts)
35
37
 
36
- unless opts.key?(:url)
37
- driver_path = opts.delete(:driver_path) || Firefox.driver_path
38
- driver_opts = opts.delete(:driver_opts) || {}
39
- port = opts.delete(:port) || Service::DEFAULT_PORT
40
-
41
- @service = Service.new(driver_path, port, driver_opts)
42
- @service.start
43
- opts[:url] = @service.uri
44
- end
38
+ opts[:url] ||= service_url(opts)
45
39
 
46
40
  listener = opts.delete(:listener)
47
41
  WebDriver.logger.info 'Skipping handshake as we know it is W3C.'
@@ -61,13 +55,13 @@ module Selenium
61
55
  def quit
62
56
  super
63
57
  ensure
64
- @service.stop if @service
58
+ @service&.stop
65
59
  end
66
60
 
67
61
  private
68
62
 
69
63
  def create_capabilities(opts)
70
- caps = opts.delete(:desired_capabilities) { Remote::W3C::Capabilities.firefox }
64
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
71
65
  options = opts.delete(:options) { Options.new }
72
66
 
73
67
  firefox_options = opts.delete(:firefox_options)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -22,7 +24,7 @@ module Selenium
22
24
  attr_reader :args, :prefs, :options, :profile
23
25
  attr_accessor :binary, :log_level
24
26
 
25
- KEY = 'moz:firefoxOptions'.freeze
27
+ KEY = 'moz:firefoxOptions'
26
28
 
27
29
  #
28
30
  # Create a new Options instance, only for W3C-capable versions of Firefox.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -42,6 +44,7 @@ module Selenium
42
44
  def from_name(name)
43
45
  profile = ini[name]
44
46
  return profile if profile
47
+
45
48
  raise Error::WebDriverError, "unable to find profile named: #{name.inspect}"
46
49
  end
47
50
 
@@ -131,6 +134,7 @@ module Selenium
131
134
 
132
135
  def add_webdriver_extension
133
136
  return if @extensions.key?(:webdriver)
137
+
134
138
  add_extension(WEBDRIVER_EXTENSION_PATH, :webdriver)
135
139
  end
136
140
 
@@ -163,9 +167,7 @@ module Selenium
163
167
  end
164
168
 
165
169
  def proxy=(proxy)
166
- unless proxy.is_a? Proxy
167
- raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}"
168
- end
170
+ raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}" unless proxy.is_a? Proxy
169
171
 
170
172
  case proxy.type
171
173
  when :manual
@@ -176,11 +178,7 @@ module Selenium
176
178
  set_manual_proxy_preference 'ssl', proxy.ssl
177
179
  set_manual_proxy_preference 'socks', proxy.socks
178
180
 
179
- self['network.proxy.no_proxies_on'] = if proxy.no_proxy
180
- proxy.no_proxy
181
- else
182
- ''
183
- end
181
+ self['network.proxy.no_proxies_on'] = proxy.no_proxy || ''
184
182
  when :pac
185
183
  self['network.proxy.type'] = 2
186
184
  self['network.proxy.autoconfig_url'] = proxy.pac
@@ -259,6 +257,7 @@ module Selenium
259
257
 
260
258
  File.read(path).split("\n").each do |line|
261
259
  next unless line =~ /user_pref\("([^"]+)"\s*,\s*(.+?)\);/
260
+
262
261
  key = Regexp.last_match(1).strip
263
262
  value = Regexp.last_match(2).strip
264
263
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -63,6 +65,7 @@ module Selenium
63
65
 
64
66
  def path_for(name, is_relative, path)
65
67
  return unless [name, path].any?
68
+
66
69
  is_relative ? File.join(Util.app_data_path, path) : path
67
70
  end
68
71
  end # ProfilesIni
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -23,34 +25,21 @@ module Selenium
23
25
  #
24
26
 
25
27
  class Service < WebDriver::Service
26
- DEFAULT_PORT = 4444
27
- @executable = 'geckodriver'.freeze
28
- @missing_text = <<-ERROR.gsub(/\n +| {2,}/, ' ').freeze
28
+ @default_port = 4444
29
+ @executable = 'geckodriver'
30
+ @missing_text = <<~ERROR
29
31
  Unable to find Mozilla geckodriver. Please download the server from
30
32
  https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH.
31
33
  More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.
32
34
  ERROR
33
-
34
- def stop
35
- stop_process
36
- end
35
+ @shutdown_supported = false
37
36
 
38
37
  private
39
38
 
40
- def start_process
41
- @process = build_process(@executable_path,
42
- "--binary=#{Firefox::Binary.path}",
43
- "--port=#{@port}",
44
- *@extra_args)
45
- @process.start
46
- end
47
-
48
- def cannot_connect_error_text
49
- "unable to connect to Mozilla geckodriver #{@host}:#{@port}"
50
- end
51
-
39
+ # Note: This processing is deprecated
52
40
  def extract_service_args(driver_opts)
53
41
  driver_args = super
42
+ driver_opts = driver_opts.dup
54
43
  driver_args << "--binary=#{driver_opts[:binary]}" if driver_opts.key?(:binary)
55
44
  driver_args << "--log=#{driver_opts[:log]}" if driver_opts.key?(:log)
56
45
  driver_args << "--marionette-port=#{driver_opts[:marionette_port]}" if driver_opts.key?(:marionette_port)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Licensed to the Software Freedom Conservancy (SFC) under one
2
4
  # or more contributor license agreements. See the NOTICE file
3
5
  # distributed with this work for additional information
@@ -17,19 +19,23 @@
17
19
 
18
20
  require 'selenium/webdriver/ie/driver'
19
21
  require 'selenium/webdriver/ie/options'
20
- require 'selenium/webdriver/ie/service'
21
22
 
22
23
  module Selenium
23
24
  module WebDriver
24
25
  module IE
25
26
  def self.driver_path=(path)
26
- Platform.assert_executable path
27
- @driver_path = path
27
+ WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path=',
28
+ 'Selenium::WebDriver::IE::Service#driver_path='
29
+ Selenium::WebDriver::IE::Service.driver_path = path
28
30
  end
29
31
 
30
32
  def self.driver_path
31
- @driver_path ||= nil
33
+ WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path',
34
+ 'Selenium::WebDriver::IE::Service#driver_path'
35
+ Selenium::WebDriver::IE::Service.driver_path
32
36
  end
33
37
  end # IE
34
38
  end # WebDriver
35
39
  end # Selenium
40
+
41
+ require 'selenium/webdriver/ie/service'