selenium-webdriver 3.141.0 → 3.142.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +125 -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/{options.rb → manager.rb} +27 -1
  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/platform.rb +26 -30
  59. data/lib/selenium/webdriver/common/port_prober.rb +6 -19
  60. data/lib/selenium/webdriver/common/profile_helper.rb +2 -0
  61. data/lib/selenium/webdriver/common/proxy.rb +13 -5
  62. data/lib/selenium/webdriver/common/search_context.rb +6 -8
  63. data/lib/selenium/webdriver/common/service.rb +87 -29
  64. data/lib/selenium/webdriver/common/socket_lock.rb +10 -3
  65. data/lib/selenium/webdriver/common/socket_poller.rb +26 -18
  66. data/lib/selenium/webdriver/common/target_locator.rb +6 -4
  67. data/lib/selenium/webdriver/common/timeouts.rb +2 -0
  68. data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -6
  69. data/lib/selenium/webdriver/common/touch_screen.rb +4 -1
  70. data/lib/selenium/webdriver/common/w3c_action_builder.rb +3 -0
  71. data/lib/selenium/webdriver/common/{w3c_options.rb → w3c_manager.rb} +3 -1
  72. data/lib/selenium/webdriver/common/wait.rb +13 -5
  73. data/lib/selenium/webdriver/common/window.rb +2 -0
  74. data/lib/selenium/webdriver/common/zipper.rb +3 -3
  75. data/lib/selenium/webdriver/edge.rb +11 -5
  76. data/lib/selenium/webdriver/edge/bridge.rb +2 -0
  77. data/lib/selenium/webdriver/edge/driver.rb +5 -12
  78. data/lib/selenium/webdriver/edge/options.rb +3 -0
  79. data/lib/selenium/webdriver/edge/service.rb +8 -12
  80. data/lib/selenium/webdriver/firefox.rb +10 -4
  81. data/lib/selenium/webdriver/firefox/binary.rb +7 -6
  82. data/lib/selenium/webdriver/firefox/bridge.rb +47 -0
  83. data/lib/selenium/webdriver/firefox/driver.rb +2 -0
  84. data/lib/selenium/webdriver/firefox/extension.rb +4 -4
  85. data/lib/selenium/webdriver/firefox/launcher.rb +3 -0
  86. data/lib/selenium/webdriver/firefox/legacy/driver.rb +7 -3
  87. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +4 -2
  88. data/lib/selenium/webdriver/firefox/marionette/driver.rb +5 -11
  89. data/lib/selenium/webdriver/firefox/options.rb +20 -7
  90. data/lib/selenium/webdriver/firefox/profile.rb +7 -8
  91. data/lib/selenium/webdriver/firefox/profiles_ini.rb +3 -0
  92. data/lib/selenium/webdriver/firefox/service.rb +8 -19
  93. data/lib/selenium/webdriver/firefox/util.rb +2 -0
  94. data/lib/selenium/webdriver/ie.rb +10 -4
  95. data/lib/selenium/webdriver/ie/driver.rb +4 -10
  96. data/lib/selenium/webdriver/ie/options.rb +4 -2
  97. data/lib/selenium/webdriver/ie/service.rb +8 -12
  98. data/lib/selenium/webdriver/remote.rb +2 -0
  99. data/lib/selenium/webdriver/remote/bridge.rb +6 -4
  100. data/lib/selenium/webdriver/remote/capabilities.rb +23 -10
  101. data/lib/selenium/webdriver/remote/commands.rb +156 -0
  102. data/lib/selenium/webdriver/remote/driver.rb +2 -0
  103. data/lib/selenium/webdriver/remote/http/common.rb +11 -4
  104. data/lib/selenium/webdriver/remote/http/curb.rb +4 -2
  105. data/lib/selenium/webdriver/remote/http/default.rb +31 -25
  106. data/lib/selenium/webdriver/remote/http/persistent.rb +3 -1
  107. data/lib/selenium/webdriver/remote/oss/bridge.rb +5 -2
  108. data/lib/selenium/webdriver/remote/oss/commands.rb +106 -104
  109. data/lib/selenium/webdriver/remote/response.rb +11 -3
  110. data/lib/selenium/webdriver/remote/server_error.rb +2 -0
  111. data/lib/selenium/webdriver/remote/w3c/bridge.rb +28 -13
  112. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +37 -21
  113. data/lib/selenium/webdriver/remote/w3c/commands.rb +61 -58
  114. data/lib/selenium/webdriver/safari.rb +11 -4
  115. data/lib/selenium/webdriver/safari/bridge.rb +5 -3
  116. data/lib/selenium/webdriver/safari/driver.rb +8 -10
  117. data/lib/selenium/webdriver/safari/options.rb +2 -0
  118. data/lib/selenium/webdriver/safari/service.rb +6 -25
  119. data/lib/selenium/webdriver/support.rb +2 -0
  120. data/lib/selenium/webdriver/support/abstract_event_listener.rb +2 -0
  121. data/lib/selenium/webdriver/support/block_event_listener.rb +3 -1
  122. data/lib/selenium/webdriver/support/color.rb +11 -9
  123. data/lib/selenium/webdriver/support/escaper.rb +2 -0
  124. data/lib/selenium/webdriver/support/event_firing_bridge.rb +3 -1
  125. data/lib/selenium/webdriver/support/select.rb +19 -18
  126. data/lib/selenium/webdriver/version.rb +3 -1
  127. data/selenium-webdriver.gemspec +14 -7
  128. metadata +89 -23
@@ -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
@@ -45,16 +47,21 @@ module Selenium
45
47
  private
46
48
 
47
49
  def lock
48
- max_time = Time.now + @timeout
50
+ max_time = current_time + @timeout
49
51
 
50
- sleep 0.1 until can_lock? || Time.now >= max_time
52
+ sleep 0.1 until can_lock? || current_time >= max_time
51
53
 
52
54
  return if did_lock?
55
+
53
56
  raise Error::WebDriverError, "unable to bind to locking port #{@port} within #{@timeout} seconds"
54
57
  end
55
58
 
59
+ def current_time
60
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
61
+ end
62
+
56
63
  def release
57
- @server && @server.close
64
+ @server&.close
58
65
  end
59
66
 
60
67
  def can_lock?
@@ -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
@@ -54,12 +56,14 @@ module Selenium
54
56
 
55
57
  CONNECT_TIMEOUT = 5
56
58
 
57
- NOT_CONNECTED_ERRORS = [Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError]
58
- NOT_CONNECTED_ERRORS << Errno::EPERM if Platform.cygwin?
59
+ NOT_CONNECTED_ERRORS = [Errno::ECONNREFUSED, Errno::ENOTCONN, SocketError].tap { |arr|
60
+ arr << Errno::EPERM if Platform.cygwin?
61
+ }.freeze
59
62
 
60
- CONNECTED_ERRORS = [Errno::EISCONN]
61
- CONNECTED_ERRORS << Errno::EINVAL if Platform.windows?
62
- CONNECTED_ERRORS << Errno::EALREADY if Platform.wsl?
63
+ CONNECTED_ERRORS = [Errno::EISCONN].tap { |arr|
64
+ arr << Errno::EINVAL if Platform.windows?
65
+ arr << Errno::EALREADY if Platform.wsl?
66
+ }.freeze
63
67
 
64
68
  if Platform.jruby?
65
69
  # we use a plain TCPSocket here since JRuby has issues select()ing on a connecting socket
@@ -79,7 +83,7 @@ module Selenium
79
83
  begin
80
84
  sock.connect_nonblock sockaddr
81
85
  rescue Errno::EINPROGRESS
82
- retry if IO.select(nil, [sock], nil, CONNECT_TIMEOUT)
86
+ retry if socket_writable?(sock) && conn_completed?(sock)
83
87
  raise Errno::ECONNREFUSED
84
88
  rescue *CONNECTED_ERRORS
85
89
  # yay!
@@ -88,30 +92,34 @@ module Selenium
88
92
  sock.close
89
93
  true
90
94
  rescue *NOT_CONNECTED_ERRORS
91
- sock.close if sock
95
+ sock&.close
92
96
  WebDriver.logger.debug("polling for socket on #{[@host, @port].inspect}")
93
97
  false
94
98
  end
95
99
  end
96
100
 
101
+ def socket_writable?(sock)
102
+ IO.select(nil, [sock], nil, CONNECT_TIMEOUT)
103
+ end
104
+
105
+ def conn_completed?(sock)
106
+ sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).int.zero?
107
+ end
108
+
97
109
  def with_timeout
98
- max_time = time_now + @timeout
110
+ max_time = current_time + @timeout
99
111
 
100
- (
112
+ until current_time > max_time
101
113
  return true if yield
102
- wait
103
- ) until time_now > max_time
104
114
 
105
- false
106
- end
115
+ sleep @interval
116
+ end
107
117
 
108
- def wait
109
- sleep @interval
118
+ false
110
119
  end
111
120
 
112
- # for testability
113
- def time_now
114
- Time.now
121
+ def current_time
122
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
115
123
  end
116
124
  end # SocketPoller
117
125
  end # WebDriver
@@ -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
@@ -55,10 +57,10 @@ module Selenium
55
57
  def window(id)
56
58
  if block_given?
57
59
  original = begin
58
- @bridge.window_handle
59
- rescue Error::NoSuchWindowError
60
- nil
61
- end
60
+ @bridge.window_handle
61
+ rescue Error::NoSuchWindowError
62
+ nil
63
+ end
62
64
 
63
65
  unless @bridge.window_handles.include? id
64
66
  raise Error::NoSuchWindowError, "The specified identifier '#{id}' is not found in the window handle list"
@@ -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
@@ -23,23 +25,20 @@ module Selenium
23
25
  #
24
26
 
25
27
  def initialize(mouse, keyboard, touch_screen)
28
+ WebDriver.logger.deprecate(self.class.name)
26
29
  super(mouse, keyboard)
27
30
  @devices[:touch_screen] = touch_screen
28
31
  end
29
32
 
30
33
  def scroll(*args)
31
- unless [2, 3].include? args.size
32
- raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}"
33
- end
34
+ raise ArgumentError, "wrong number of arguments, expected 2..3, got #{args.size}" unless [2, 3].include? args.size
34
35
 
35
36
  @actions << [:touch_screen, :scroll, args]
36
37
  self
37
38
  end
38
39
 
39
40
  def flick(*args)
40
- unless [2, 4].include? args.size
41
- raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
42
- end
41
+ raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}" unless [2, 4].include? args.size
43
42
 
44
43
  @actions << [:touch_screen, :flick, args]
45
44
  self
@@ -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,7 +84,7 @@ module Selenium
82
84
 
83
85
  assert_element element
84
86
 
85
- if (speed.is_a?(String) || speed.is_a?(Symbol)) && FLICK_SPEED.keys.include?(speed.to_sym)
87
+ if (speed.is_a?(String) || speed.is_a?(Symbol)) && FLICK_SPEED.key?(speed.to_sym)
86
88
  WebDriver.logger.deprecate "Passing #{speed.inspect} speed",
87
89
  "Integer or Selenium::WebDriver::TouchScreen::FLICK_SPEED[:#{speed}]"
88
90
  speed = FLICK_SPEED[speed.to_sym]
@@ -113,6 +115,7 @@ module Selenium
113
115
 
114
116
  def assert_element(element)
115
117
  return if element.is_a? Element
118
+
116
119
  raise TypeError, "expected #{Element}, got #{element.inspect}:#{element.class}"
117
120
  end
118
121
  end # TouchScreen
@@ -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
@@ -190,6 +192,7 @@ module Selenium
190
192
 
191
193
  def tick(*action_devices)
192
194
  return if @async
195
+
193
196
  @devices.each { |device| device.create_pause unless action_devices.include? device }
194
197
  end
195
198
 
@@ -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,7 +19,7 @@
17
19
 
18
20
  module Selenium
19
21
  module WebDriver
20
- class W3COptions < Options
22
+ class W3CManager < Manager
21
23
 
22
24
  #
23
25
  # Get the cookie with the given name
@@ -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
@@ -41,15 +43,15 @@ module Selenium
41
43
  #
42
44
  # Wait until the given block returns a true value.
43
45
  #
44
- # @raise [Error::TimeOutError]
46
+ # @raise [Error::TimeoutError]
45
47
  # @return [Object] the result of the block
46
48
  #
47
49
 
48
50
  def until
49
- end_time = Time.now + @timeout
51
+ end_time = current_time + @timeout
50
52
  last_error = nil
51
53
 
52
- until Time.now > end_time
54
+ until current_time > end_time
53
55
  begin
54
56
  result = yield
55
57
  return result if result
@@ -63,12 +65,18 @@ module Selenium
63
65
  msg = if @message
64
66
  @message.dup
65
67
  else
66
- "timed out after #{@timeout} seconds"
68
+ +"timed out after #{@timeout} seconds"
67
69
  end
68
70
 
69
71
  msg << " (#{last_error.message})" if last_error
70
72
 
71
- raise Error::TimeOutError, msg
73
+ raise Error::TimeoutError, msg
74
+ end
75
+
76
+ private
77
+
78
+ def current_time
79
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
72
80
  end
73
81
  end # Wait
74
82
  end # WebDriver
@@ -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
@@ -50,9 +52,7 @@ module Selenium
50
52
  def zip(path)
51
53
  with_tmp_zip do |zip|
52
54
  ::Find.find(path) do |file|
53
- unless File.directory?(file)
54
- add_zip_entry zip, file, file.sub("#{path}/", '')
55
- end
55
+ add_zip_entry zip, file, file.sub("#{path}/", '') unless File.directory?(file)
56
56
  end
57
57
 
58
58
  zip.commit
@@ -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,19 +22,23 @@ require 'net/http'
20
22
  require 'selenium/webdriver/edge/bridge'
21
23
  require 'selenium/webdriver/edge/driver'
22
24
  require 'selenium/webdriver/edge/options'
23
- require 'selenium/webdriver/edge/service'
24
25
 
25
26
  module Selenium
26
27
  module WebDriver
27
28
  module Edge
28
29
  def self.driver_path=(path)
29
- Platform.assert_executable path
30
- @driver_path = path
30
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path=',
31
+ 'Selenium::WebDriver::Edge::Service#driver_path='
32
+ Selenium::WebDriver::Edge::Service.driver_path = path
31
33
  end
32
34
 
33
- def self.driver_path(warning = true)
34
- @driver_path ||= nil
35
+ def self.driver_path
36
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Edge#driver_path',
37
+ 'Selenium::WebDriver::Edge::Service#driver_path'
38
+ Selenium::WebDriver::Edge::Service.driver_path
35
39
  end
36
40
  end # Edge
37
41
  end # WebDriver
38
42
  end # Selenium
43
+
44
+ require 'selenium/webdriver/edge/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
@@ -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,18 +30,9 @@ module Selenium
28
30
  include DriverExtensions::TakesScreenshot
29
31
 
30
32
  def initialize(opts = {})
31
- opts[:desired_capabilities] ||= Remote::W3C::Capabilities.edge
32
-
33
- unless opts.key?(:url)
34
- driver_path = opts.delete(:driver_path) || Edge.driver_path
35
- driver_opts = opts.delete(:driver_opts) || {}
36
- port = opts.delete(:port) || Service::DEFAULT_PORT
33
+ opts[:desired_capabilities] ||= Remote::Capabilities.edge
37
34
 
38
- @service = Service.new(driver_path, port, driver_opts)
39
- @service.host = 'localhost' if @service.host == '127.0.0.1'
40
- @service.start
41
- opts[:url] = @service.uri
42
- end
35
+ opts[:url] ||= service_url(opts)
43
36
 
44
37
  listener = opts.delete(:listener)
45
38
 
@@ -64,7 +57,7 @@ module Selenium
64
57
  def quit
65
58
  super
66
59
  ensure
67
- @service.stop if @service
60
+ @service&.stop
68
61
  end
69
62
 
70
63
  end # Driver
@@ -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
@@ -55,6 +57,7 @@ module Selenium
55
57
 
56
58
  def add_extension_path(path)
57
59
  raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.directory?(path)
60
+
58
61
  @extension_paths << path
59
62
  end
60
63
 
@@ -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'