selenium-webdriver 3.142.7 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +685 -5
  3. data/Gemfile +6 -1
  4. data/LICENSE +1 -1
  5. data/NOTICE +2 -0
  6. data/README.md +4 -5
  7. data/bin/linux/selenium-manager +0 -0
  8. data/bin/macos/selenium-manager +0 -0
  9. data/bin/windows/selenium-manager.exe +0 -0
  10. data/lib/selenium/server.rb +93 -90
  11. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  12. data/lib/selenium/webdriver/atoms/getAttribute.js +100 -7
  13. data/lib/selenium/webdriver/atoms/isDisplayed.js +77 -78
  14. data/lib/selenium/webdriver/atoms/mutationListener.js +55 -0
  15. data/lib/selenium/webdriver/atoms.rb +5 -3
  16. data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
  17. data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
  18. data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
  19. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
  20. data/lib/selenium/webdriver/bidi/log/filter_by.rb +40 -0
  21. data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
  22. data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
  23. data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
  24. data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
  25. data/lib/selenium/webdriver/bidi/session.rb +51 -0
  26. data/lib/selenium/webdriver/{common/keyboard.rb → bidi.rb} +21 -35
  27. data/lib/selenium/webdriver/chrome/driver.rb +9 -86
  28. data/lib/selenium/webdriver/chrome/features.rb +48 -0
  29. data/lib/selenium/webdriver/chrome/options.rb +9 -158
  30. data/lib/selenium/webdriver/chrome/profile.rb +3 -80
  31. data/lib/selenium/webdriver/chrome/service.rb +7 -29
  32. data/lib/selenium/webdriver/chrome.rb +5 -20
  33. data/lib/selenium/webdriver/chromium/driver.rb +60 -0
  34. data/lib/selenium/webdriver/{chrome/bridge.rb → chromium/features.rb} +48 -17
  35. data/lib/selenium/webdriver/chromium/options.rb +243 -0
  36. data/lib/selenium/webdriver/chromium/profile.rb +113 -0
  37. data/lib/selenium/webdriver/chromium.rb +29 -0
  38. data/lib/selenium/webdriver/common/action_builder.rb +126 -238
  39. data/lib/selenium/webdriver/common/child_process.rb +124 -0
  40. data/lib/selenium/webdriver/common/driver.rb +82 -43
  41. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
  42. data/lib/selenium/webdriver/common/driver_extensions/{has_location.rb → full_page_screenshot.rb} +13 -11
  43. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  44. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +49 -0
  45. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +87 -0
  46. data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_bidi.rb} +9 -9
  47. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +86 -0
  48. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +36 -0
  49. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +42 -0
  50. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
  51. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +41 -0
  52. data/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rb +65 -0
  53. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +36 -0
  54. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +143 -0
  55. data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_logs.rb} +4 -4
  56. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +16 -1
  57. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +69 -0
  58. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -13
  59. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +75 -0
  60. data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
  61. data/lib/selenium/webdriver/common/driver_finder.rb +45 -0
  62. data/lib/selenium/webdriver/common/element.rb +89 -29
  63. data/lib/selenium/webdriver/common/error.rb +53 -194
  64. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
  65. data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
  66. data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -22
  67. data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
  68. data/lib/selenium/webdriver/common/interactions/key_actions.rb +10 -6
  69. data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
  70. data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
  71. data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
  72. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +71 -82
  73. data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
  74. data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
  75. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
  76. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
  77. data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
  78. data/lib/selenium/webdriver/common/interactions/scroll.rb +59 -0
  79. data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
  80. data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
  81. data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
  82. data/lib/selenium/webdriver/common/{w3c_manager.rb → interactions/wheel_input.rb} +14 -17
  83. data/lib/selenium/webdriver/common/keys.rb +1 -0
  84. data/lib/selenium/webdriver/common/local_driver.rb +46 -0
  85. data/lib/selenium/webdriver/common/log_entry.rb +2 -2
  86. data/lib/selenium/webdriver/common/logger.rb +119 -19
  87. data/lib/selenium/webdriver/common/manager.rb +11 -38
  88. data/lib/selenium/webdriver/common/options.rb +154 -23
  89. data/lib/selenium/webdriver/common/platform.rb +15 -52
  90. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  91. data/lib/selenium/webdriver/common/profile_helper.rb +11 -9
  92. data/lib/selenium/webdriver/common/proxy.rb +8 -5
  93. data/lib/selenium/webdriver/common/search_context.rb +7 -9
  94. data/lib/selenium/webdriver/common/selenium_manager.rb +140 -0
  95. data/lib/selenium/webdriver/common/service.rb +26 -143
  96. data/lib/selenium/webdriver/common/service_manager.rb +144 -0
  97. data/lib/selenium/webdriver/common/shadow_root.rb +86 -0
  98. data/lib/selenium/webdriver/common/socket_lock.rb +4 -4
  99. data/lib/selenium/webdriver/common/socket_poller.rb +4 -4
  100. data/lib/selenium/webdriver/common/takes_screenshot.rb +65 -0
  101. data/lib/selenium/webdriver/common/target_locator.rb +31 -4
  102. data/lib/selenium/webdriver/common/timeouts.rb +31 -4
  103. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +85 -0
  104. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +72 -0
  105. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
  106. data/lib/selenium/webdriver/common/wait.rb +1 -1
  107. data/lib/selenium/webdriver/common/websocket_connection.rb +164 -0
  108. data/lib/selenium/webdriver/common/window.rb +6 -10
  109. data/lib/selenium/webdriver/common/zipper.rb +4 -10
  110. data/lib/selenium/webdriver/common.rb +43 -20
  111. data/lib/selenium/webdriver/devtools/console_event.rb +36 -0
  112. data/lib/selenium/webdriver/devtools/exception_event.rb +34 -0
  113. data/lib/selenium/webdriver/devtools/mutation_event.rb +35 -0
  114. data/lib/selenium/webdriver/devtools/network_interceptor.rb +173 -0
  115. data/lib/selenium/webdriver/devtools/pinned_script.rb +57 -0
  116. data/lib/selenium/webdriver/devtools/request.rb +65 -0
  117. data/lib/selenium/webdriver/devtools/response.rb +64 -0
  118. data/lib/selenium/webdriver/devtools.rb +96 -0
  119. data/lib/selenium/webdriver/edge/driver.rb +11 -27
  120. data/lib/selenium/webdriver/edge/features.rb +48 -0
  121. data/lib/selenium/webdriver/edge/options.rb +18 -43
  122. data/lib/selenium/webdriver/edge/profile.rb +33 -0
  123. data/lib/selenium/webdriver/edge/service.rb +8 -23
  124. data/lib/selenium/webdriver/edge.rb +11 -16
  125. data/lib/selenium/webdriver/firefox/driver.rb +38 -19
  126. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  127. data/lib/selenium/webdriver/firefox/features.rb +70 -0
  128. data/lib/selenium/webdriver/firefox/options.rb +73 -61
  129. data/lib/selenium/webdriver/firefox/profile.rb +20 -72
  130. data/lib/selenium/webdriver/firefox/service.rb +3 -25
  131. data/lib/selenium/webdriver/firefox/util.rb +1 -1
  132. data/lib/selenium/webdriver/firefox.rb +17 -28
  133. data/lib/selenium/webdriver/ie/driver.rb +5 -45
  134. data/lib/selenium/webdriver/ie/features.rb +34 -0
  135. data/lib/selenium/webdriver/ie/options.rb +14 -44
  136. data/lib/selenium/webdriver/ie/service.rb +3 -27
  137. data/lib/selenium/webdriver/ie.rb +4 -16
  138. data/lib/selenium/webdriver/remote/bridge/commands.rb +164 -0
  139. data/lib/selenium/webdriver/remote/bridge.rb +574 -88
  140. data/lib/selenium/webdriver/remote/capabilities.rb +144 -158
  141. data/lib/selenium/webdriver/remote/driver.rb +45 -14
  142. data/lib/selenium/webdriver/remote/features.rb +75 -0
  143. data/lib/selenium/webdriver/remote/http/common.rb +3 -8
  144. data/lib/selenium/webdriver/remote/http/curb.rb +1 -3
  145. data/lib/selenium/webdriver/remote/http/default.rb +24 -33
  146. data/lib/selenium/webdriver/remote/response.rb +17 -49
  147. data/lib/selenium/webdriver/remote/server_error.rb +1 -1
  148. data/lib/selenium/webdriver/remote.rb +15 -12
  149. data/lib/selenium/webdriver/safari/driver.rb +7 -29
  150. data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +7 -5
  151. data/lib/selenium/webdriver/safari/options.rb +12 -27
  152. data/lib/selenium/webdriver/safari/service.rb +13 -11
  153. data/lib/selenium/webdriver/safari.rb +14 -20
  154. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
  155. data/lib/selenium/webdriver/support/color.rb +24 -24
  156. data/lib/selenium/webdriver/support/event_firing_bridge.rb +5 -5
  157. data/lib/selenium/webdriver/support/guards/guard.rb +90 -0
  158. data/lib/selenium/webdriver/{firefox/marionette/bridge.rb → support/guards/guard_condition.rb} +21 -20
  159. data/lib/selenium/webdriver/support/guards.rb +95 -0
  160. data/lib/selenium/webdriver/support/relative_locator.rb +50 -0
  161. data/lib/selenium/webdriver/support/select.rb +6 -4
  162. data/lib/selenium/webdriver/support.rb +1 -0
  163. data/lib/selenium/webdriver/version.rb +1 -1
  164. data/lib/selenium/webdriver.rb +19 -17
  165. data/selenium-webdriver.gemspec +36 -18
  166. metadata +161 -91
  167. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  168. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +0 -58
  169. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
  170. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  171. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  172. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  173. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  174. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  175. data/lib/selenium/webdriver/firefox/binary.rb +0 -187
  176. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  177. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  178. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  179. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  180. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  181. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  182. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  183. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -60
  184. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  185. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  186. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  187. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  188. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -23,18 +23,20 @@ module Selenium
23
23
  class Profile
24
24
  include ProfileHelper
25
25
 
26
- VALID_PREFERENCE_TYPES = [TrueClass, FalseClass, Integer, Float, String].freeze
27
- WEBDRIVER_EXTENSION_PATH = File.expand_path("#{WebDriver.root}/selenium/webdriver/firefox/extension/webdriver.xpi")
28
- WEBDRIVER_PREFS = {
29
- native_events: 'webdriver_enable_native_events',
30
- untrusted_certs: 'webdriver_accept_untrusted_certs',
31
- untrusted_issuer: 'webdriver_assume_untrusted_issuer',
32
- port: 'webdriver_firefox_port',
33
- log_file: 'webdriver.log.file'
26
+ VALID_PREFERENCE_TYPES = [TrueClass, FalseClass, Integer, Float, String].freeze
27
+
28
+ DEFAULT_PREFERENCES = {
29
+ 'browser.newtabpage.enabled' => false,
30
+ 'browser.startup.homepage' => 'about:blank',
31
+ 'browser.usedOnWindows10.introURL' => 'about:blank',
32
+ 'network.captive-portal-service.enabled' => false,
33
+ 'security.csp.enable' => false
34
34
  }.freeze
35
35
 
36
+ LOCK_FILES = %w[.parentlock parent.lock lock].freeze
37
+
36
38
  attr_reader :name, :log_file
37
- attr_writer :secure_ssl, :native_events, :load_no_focus_lib
39
+ attr_writer :secure_ssl, :load_no_focus_lib
38
40
 
39
41
  class << self
40
42
  def ini
@@ -48,10 +50,8 @@ module Selenium
48
50
  raise Error::WebDriverError, "unable to find profile named: #{name.inspect}"
49
51
  end
50
52
 
51
- def default_preferences
52
- @default_preferences ||= JSON.parse(
53
- File.read(File.expand_path("#{WebDriver.root}/selenium/webdriver/firefox/extension/prefs.json"))
54
- ).freeze
53
+ def decoded(json)
54
+ JSON.parse(json)
55
55
  end
56
56
  end
57
57
 
@@ -70,25 +70,7 @@ module Selenium
70
70
  def initialize(model = nil)
71
71
  @model = verify_model(model)
72
72
 
73
- model_prefs = read_model_prefs
74
-
75
- if model_prefs.empty?
76
- @native_events = DEFAULT_ENABLE_NATIVE_EVENTS
77
- @secure_ssl = DEFAULT_SECURE_SSL
78
- @untrusted_issuer = DEFAULT_ASSUME_UNTRUSTED_ISSUER
79
- @load_no_focus_lib = DEFAULT_LOAD_NO_FOCUS_LIB
80
-
81
- @additional_prefs = {}
82
- else
83
- # TODO: clean this up
84
- @native_events = model_prefs.delete(WEBDRIVER_PREFS[:native_events]) == 'true'
85
- @secure_ssl = model_prefs.delete(WEBDRIVER_PREFS[:untrusted_certs]) != 'true'
86
- @untrusted_issuer = model_prefs.delete(WEBDRIVER_PREFS[:untrusted_issuer]) == 'true'
87
- # not stored in profile atm, so will always be false.
88
- @load_no_focus_lib = model_prefs.delete(WEBDRIVER_PREFS[:load_no_focus_lib]) == 'true'
89
- @additional_prefs = model_prefs
90
- end
91
-
73
+ @additional_prefs = read_model_prefs
92
74
  @extensions = {}
93
75
  end
94
76
 
@@ -132,12 +114,6 @@ module Selenium
132
114
  self[WEBDRIVER_PREFS[:log_file]] = file
133
115
  end
134
116
 
135
- def add_webdriver_extension
136
- return if @extensions.key?(:webdriver)
137
-
138
- add_extension(WEBDRIVER_EXTENSION_PATH, :webdriver)
139
- end
140
-
141
117
  #
142
118
  # Add the extension (directory, .zip or .xpi) at the given path to the profile.
143
119
  #
@@ -146,26 +122,6 @@ module Selenium
146
122
  @extensions[name] = Extension.new(path)
147
123
  end
148
124
 
149
- def native_events?
150
- @native_events == true
151
- end
152
-
153
- def load_no_focus_lib?
154
- @load_no_focus_lib == true
155
- end
156
-
157
- def secure_ssl?
158
- @secure_ssl == true
159
- end
160
-
161
- def assume_untrusted_certificate_issuer?
162
- @untrusted_issuer == true
163
- end
164
-
165
- def assume_untrusted_certificate_issuer=(bool)
166
- @untrusted_issuer = bool
167
- end
168
-
169
125
  def proxy=(proxy)
170
126
  raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}" unless proxy.is_a? Proxy
171
127
 
@@ -189,9 +145,7 @@ module Selenium
189
145
  end
190
146
  end
191
147
 
192
- def encoded
193
- Zipper.zip(layout_on_disk)
194
- end
148
+ alias as_json encoded
195
149
 
196
150
  private
197
151
 
@@ -208,7 +162,7 @@ module Selenium
208
162
  destination = File.join(directory, 'extensions')
209
163
 
210
164
  @extensions.each do |name, extension|
211
- WebDriver.logger.debug({extenstion: name}.inspect)
165
+ WebDriver.logger.debug({extension: name}.inspect, id: :firefox_profile)
212
166
  extension.write_to(destination)
213
167
  end
214
168
  end
@@ -224,7 +178,7 @@ module Selenium
224
178
  end
225
179
 
226
180
  def delete_lock_files(directory)
227
- %w[.parentlock parent.lock].each do |name|
181
+ LOCK_FILES.each do |name|
228
182
  FileUtils.rm_f File.join(directory, name)
229
183
  end
230
184
  end
@@ -236,17 +190,11 @@ module Selenium
236
190
  def update_user_prefs_in(directory)
237
191
  path = File.join(directory, 'user.js')
238
192
  prefs = read_user_prefs(path)
239
-
240
- prefs.merge! self.class.default_preferences.fetch 'mutable'
241
- prefs.merge! @additional_prefs
242
- prefs.merge! self.class.default_preferences.fetch 'frozen'
243
-
244
- prefs[WEBDRIVER_PREFS[:untrusted_certs]] = !secure_ssl?
245
- prefs[WEBDRIVER_PREFS[:native_events]] = native_events?
246
- prefs[WEBDRIVER_PREFS[:untrusted_issuer]] = assume_untrusted_certificate_issuer?
193
+ prefs.merge! self.class::DEFAULT_PREFERENCES
194
+ prefs.merge!(@additional_prefs)
247
195
 
248
196
  # If the user sets the home page, we should also start up there
249
- prefs['startup.homepage_welcome_url'] = prefs['browser.startup.homepage']
197
+ prefs['startup.homepage_welcome_url'] ||= prefs['browser.startup.homepage']
250
198
 
251
199
  write_prefs prefs, path
252
200
  end
@@ -20,32 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Firefox
23
- #
24
- # @api private
25
- #
26
-
27
23
  class Service < WebDriver::Service
28
- @default_port = 4444
29
- @executable = 'geckodriver'
30
- @missing_text = <<~ERROR
31
- Unable to find Mozilla geckodriver. Please download the server from
32
- https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH.
33
- More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.
34
- ERROR
35
- @shutdown_supported = false
36
-
37
- private
38
-
39
- # Note: This processing is deprecated
40
- def extract_service_args(driver_opts)
41
- driver_args = super
42
- driver_opts = driver_opts.dup
43
- driver_args << "--binary=#{driver_opts[:binary]}" if driver_opts.key?(:binary)
44
- driver_args << "--log=#{driver_opts[:log]}" if driver_opts.key?(:log)
45
- driver_args << "--marionette-port=#{driver_opts[:marionette_port]}" if driver_opts.key?(:marionette_port)
46
- driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
47
- driver_args
48
- end
24
+ DEFAULT_PORT = 4444
25
+ EXECUTABLE = 'geckodriver'
26
+ SHUTDOWN_SUPPORTED = false
49
27
  end # Service
50
28
  end # Firefox
51
29
  end # WebDriver
@@ -27,7 +27,7 @@ module Selenium
27
27
  def app_data_path
28
28
  case Platform.os
29
29
  when :windows
30
- "#{ENV['APPDATA']}\\Mozilla\\Firefox"
30
+ "#{ENV.fetch('APPDATA')}\\Mozilla\\Firefox"
31
31
  when :macosx
32
32
  "#{Platform.home}/Library/Application Support/Firefox"
33
33
  when :unix, :linux
@@ -21,46 +21,35 @@ require 'timeout'
21
21
  require 'socket'
22
22
  require 'rexml/document'
23
23
 
24
- require 'selenium/webdriver/firefox/driver'
25
-
26
- require 'selenium/webdriver/firefox/util'
27
- require 'selenium/webdriver/firefox/extension'
28
- require 'selenium/webdriver/firefox/binary'
29
- require 'selenium/webdriver/firefox/profiles_ini'
30
- require 'selenium/webdriver/firefox/profile'
31
- require 'selenium/webdriver/firefox/launcher'
32
- require 'selenium/webdriver/firefox/legacy/driver'
33
-
34
- require 'selenium/webdriver/firefox/marionette/bridge'
35
- require 'selenium/webdriver/firefox/marionette/driver'
36
- require 'selenium/webdriver/firefox/options'
37
-
38
24
  module Selenium
39
25
  module WebDriver
40
26
  module Firefox
27
+ autoload :Util, 'selenium/webdriver/firefox/util'
28
+ autoload :Extension, 'selenium/webdriver/firefox/extension'
29
+ autoload :ProfilesIni, 'selenium/webdriver/firefox/profiles_ini'
30
+ autoload :Profile, 'selenium/webdriver/firefox/profile'
31
+ autoload :Features, 'selenium/webdriver/firefox/features'
32
+ autoload :Driver, 'selenium/webdriver/firefox/driver'
33
+ autoload :Options, 'selenium/webdriver/firefox/options'
34
+ autoload :Service, 'selenium/webdriver/firefox/service'
35
+
41
36
  DEFAULT_PORT = 7055
42
- DEFAULT_ENABLE_NATIVE_EVENTS = Platform.os == :windows
43
37
  DEFAULT_SECURE_SSL = false
44
38
  DEFAULT_ASSUME_UNTRUSTED_ISSUER = true
45
39
  DEFAULT_LOAD_NO_FOCUS_LIB = false
46
40
 
47
- def self.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
51
- end
41
+ # Mozilla Automation Team asked to only support 85
42
+ # until WebDriver Bidi is available.
43
+ DEVTOOLS_VERSION = 85
52
44
 
53
- def self.driver_path
54
- WebDriver.logger.deprecate 'Selenium::WebDriver::Firefox#driver_path',
55
- 'Selenium::WebDriver::Firefox::Service#driver_path'
56
- Selenium::WebDriver::Firefox::Service.driver_path
45
+ def self.path=(path)
46
+ Platform.assert_executable path
47
+ @path = path
57
48
  end
58
49
 
59
- def self.path=(path)
60
- Binary.path = path
50
+ def self.path
51
+ @path ||= nil
61
52
  end
62
53
  end # Firefox
63
54
  end # WebDriver
64
55
  end # Selenium
65
-
66
- require 'selenium/webdriver/firefox/service'
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module IE
23
-
24
23
  #
25
24
  # Driver implementation for Internet Explorer supporting
26
25
  # both OSS and W3C dialects of JSON wire protocol.
@@ -28,57 +27,18 @@ module Selenium
28
27
  #
29
28
 
30
29
  class Driver < WebDriver::Driver
31
- include DriverExtensions::HasWebStorage
32
- include DriverExtensions::TakesScreenshot
33
-
34
- def initialize(opts = {})
35
- opts[:desired_capabilities] = create_capabilities(opts)
30
+ EXTENSIONS = [DriverExtensions::HasWebStorage].freeze
36
31
 
37
- opts[:url] ||= service_url(opts)
32
+ include LocalDriver
38
33
 
39
- listener = opts.delete(:listener)
40
- @bridge = Remote::Bridge.handshake(**opts)
41
- super(@bridge, listener: listener)
34
+ def initialize(options: nil, service: nil, url: nil, **opts)
35
+ caps, url = initialize_local_driver(options, service, url)
36
+ super(caps: caps, url: url, **opts)
42
37
  end
43
38
 
44
39
  def browser
45
40
  :internet_explorer
46
41
  end
47
-
48
- def quit
49
- super
50
- ensure
51
- @service&.stop
52
- end
53
-
54
- private
55
-
56
- def create_capabilities(opts)
57
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
58
- options = opts.delete(:options) { Options.new }
59
-
60
- if opts.delete(:introduce_flakiness_by_ignoring_security_domains)
61
- WebDriver.logger.deprecate ':introduce_flakiness_by_ignoring_security_domains',
62
- 'Selenium::WebDriver::IE::Options#ignore_protected_mode_settings='
63
- options.ignore_protected_mode_settings = true
64
- end
65
-
66
- native_events = opts.delete(:native_events)
67
- unless native_events.nil?
68
- WebDriver.logger.deprecate ':native_events', 'Selenium::WebDriver::IE::Options#native_events='
69
- options.native_events = native_events
70
- end
71
-
72
- # Backward compatibility with older IEDriverServer versions
73
- caps[:ignore_protected_mode_settings] = options.ignore_protected_mode_settings
74
- caps[:native_events] = options.native_events
75
-
76
- options = options.as_json
77
- caps.merge!(options) unless options.empty?
78
-
79
- caps
80
- end
81
-
82
42
  end # Driver
83
43
  end # IE
84
44
  end # WebDriver
@@ -0,0 +1,34 @@
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 IE
23
+ module Features
24
+ def command_list
25
+ self.class::COMMANDS
26
+ end
27
+
28
+ def commands(command)
29
+ command_list[command]
30
+ end
31
+ end # Bridge
32
+ end # Ie
33
+ end # WebDriver
34
+ end # Selenium
@@ -20,7 +20,7 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module IE
23
- class Options < WebDriver::Common::Options
23
+ class Options < WebDriver::Options
24
24
  KEY = 'se:ieOptions'
25
25
  SCROLL_TOP = 0
26
26
  SCROLL_BOTTOM = 1
@@ -39,20 +39,14 @@ module Selenium
39
39
  persistent_hover: 'enablePersistentHover',
40
40
  require_window_focus: 'requireWindowFocus',
41
41
  use_per_process_proxy: 'ie.usePerProcessProxy',
42
- validate_cookie_document_type: 'ie.validateCookieDocumentType'
42
+ use_legacy_file_upload_dialog_handling: 'ie.useLegacyFileUploadDialogHandling',
43
+ attach_to_edge_chrome: 'ie.edgechromium',
44
+ edge_executable_path: 'ie.edgepath',
45
+ ignore_process_match: 'ie.ignoreprocessmatch'
43
46
  }.freeze
47
+ BROWSER = 'internet explorer'
44
48
 
45
- CAPABILITIES.each_key do |key|
46
- define_method key do
47
- @options[key]
48
- end
49
-
50
- define_method "#{key}=" do |value|
51
- @options[key] = value
52
- end
53
- end
54
-
55
- attr_reader :args, :options
49
+ attr_reader :args
56
50
 
57
51
  #
58
52
  # Create a new Options instance
@@ -86,8 +80,9 @@ module Selenium
86
80
  #
87
81
 
88
82
  def initialize(**opts)
89
- @args = Set.new(opts.delete(:args) || [])
90
- @options = opts
83
+ @args = (opts.delete(:args) || []).to_set
84
+ super(**opts)
85
+
91
86
  @options[:native_events] = true if @options[:native_events].nil?
92
87
  end
93
88
 
@@ -101,36 +96,11 @@ module Selenium
101
96
  @args << arg
102
97
  end
103
98
 
104
- #
105
- # Add a new option not yet handled by these bindings.
106
- #
107
- # @example
108
- # options = Selenium::WebDriver::IE::Options.new
109
- # options.add_option(:foo, 'bar')
110
- #
111
- # @param [String, Symbol] name Name of the option
112
- # @param [Boolean, String, Integer] value Value of the option
113
- #
114
-
115
- def add_option(name, value)
116
- @options[name] = value
117
- end
118
-
119
- #
120
- # @api private
121
- #
122
-
123
- def as_json(*)
124
- opts = {}
125
-
126
- CAPABILITIES.each do |capability_alias, capability_name|
127
- capability_value = @options.delete(capability_alias)
128
- opts[capability_name] = capability_value unless capability_value.nil?
129
- end
130
- opts['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
131
- opts.merge!(@options)
99
+ private
132
100
 
133
- {KEY => generate_as_json(opts)}
101
+ def process_browser_options(browser_options)
102
+ options = browser_options[KEY]
103
+ options['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
134
104
  end
135
105
  end # Options
136
106
  end # IE
@@ -20,34 +20,10 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module IE
23
- #
24
- # @api private
25
- #
26
-
27
23
  class Service < WebDriver::Service
28
- @default_port = 5555
29
- @executable = 'IEDriverServer'
30
- @missing_text = <<~ERROR
31
- Unable to find IEDriverServer. Please download the server from
32
- http://selenium-release.storage.googleapis.com/index.html and place it somewhere on your PATH.
33
- More info at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.
34
- ERROR
35
- @shutdown_supported = true
36
-
37
- private
38
-
39
- # Note: This processing is deprecated
40
- def extract_service_args(driver_opts)
41
- driver_args = super
42
- driver_opts = driver_opts.dup
43
- driver_args << "--log-level=#{driver_opts.delete(:log_level).to_s.upcase}" if driver_opts.key?(:log_level)
44
- driver_args << "--log-file=#{driver_opts.delete(:log_file)}" if driver_opts.key?(:log_file)
45
- driver_args << "--implementation=#{driver_opts.delete(:implementation).to_s.upcase}" if driver_opts.key?(:implementation)
46
- driver_args << "--host=#{driver_opts.delete(:host)}" if driver_opts.key?(:host)
47
- driver_args << "--extract_path=#{driver_opts.delete(:extract_path)}" if driver_opts.key?(:extract_path)
48
- driver_args << "--silent" if driver_opts[:silent] == true
49
- driver_args
50
- end
24
+ DEFAULT_PORT = 5555
25
+ EXECUTABLE = 'IEDriverServer'
26
+ SHUTDOWN_SUPPORTED = true
51
27
  end # Server
52
28
  end # IE
53
29
  end # WebDriver
@@ -17,25 +17,13 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- require 'selenium/webdriver/ie/driver'
21
- require 'selenium/webdriver/ie/options'
22
-
23
20
  module Selenium
24
21
  module WebDriver
25
22
  module IE
26
- def self.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
30
- end
31
-
32
- def self.driver_path
33
- WebDriver.logger.deprecate 'Selenium::WebDriver::IE#driver_path',
34
- 'Selenium::WebDriver::IE::Service#driver_path'
35
- Selenium::WebDriver::IE::Service.driver_path
36
- end
23
+ autoload :Features, 'selenium/webdriver/ie/features'
24
+ autoload :Driver, 'selenium/webdriver/ie/driver'
25
+ autoload :Options, 'selenium/webdriver/ie/options'
26
+ autoload :Service, 'selenium/webdriver/ie/service'
37
27
  end # IE
38
28
  end # WebDriver
39
29
  end # Selenium
40
-
41
- require 'selenium/webdriver/ie/service'