selenium-webdriver 3.142.7 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +432 -5
  3. data/Gemfile +3 -1
  4. data/LICENSE +1 -1
  5. data/NOTICE +2 -0
  6. data/README.md +4 -5
  7. data/lib/selenium/server.rb +75 -64
  8. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  9. data/lib/selenium/webdriver/atoms/getAttribute.js +100 -7
  10. data/lib/selenium/webdriver/atoms/isDisplayed.js +76 -78
  11. data/lib/selenium/webdriver/atoms/mutationListener.js +55 -0
  12. data/lib/selenium/webdriver/bidi/session.rb +38 -0
  13. data/lib/selenium/webdriver/bidi.rb +55 -0
  14. data/lib/selenium/webdriver/chrome/driver.rb +26 -83
  15. data/lib/selenium/webdriver/chrome/{bridge.rb → features.rb} +55 -12
  16. data/lib/selenium/webdriver/chrome/options.rb +138 -67
  17. data/lib/selenium/webdriver/chrome/profile.rb +6 -3
  18. data/lib/selenium/webdriver/chrome/service.rb +8 -15
  19. data/lib/selenium/webdriver/chrome.rb +5 -18
  20. data/lib/selenium/webdriver/common/action_builder.rb +171 -236
  21. data/lib/selenium/webdriver/common/driver.rb +76 -29
  22. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +43 -0
  23. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +51 -0
  24. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +89 -0
  25. data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_bidi.rb} +10 -8
  26. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +87 -0
  27. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +38 -0
  28. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +44 -0
  29. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +43 -0
  30. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +38 -0
  31. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +5 -8
  32. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +144 -0
  33. data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_logs.rb} +4 -4
  34. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +17 -0
  35. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +6 -27
  36. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +136 -0
  37. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -11
  38. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +77 -0
  39. data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
  40. data/lib/selenium/webdriver/common/element.rb +83 -23
  41. data/lib/selenium/webdriver/common/error.rb +32 -196
  42. data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
  43. data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -22
  44. data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
  45. data/lib/selenium/webdriver/common/interactions/key_actions.rb +10 -6
  46. data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
  47. data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
  48. data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
  49. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +68 -78
  50. data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
  51. data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
  52. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
  53. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
  54. data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
  55. data/lib/selenium/webdriver/common/interactions/scroll.rb +57 -0
  56. data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
  57. data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
  58. data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
  59. data/lib/selenium/webdriver/common/{w3c_manager.rb → interactions/wheel_input.rb} +14 -17
  60. data/lib/selenium/webdriver/common/keys.rb +1 -0
  61. data/lib/selenium/webdriver/common/log_entry.rb +2 -2
  62. data/lib/selenium/webdriver/common/logger.rb +50 -15
  63. data/lib/selenium/webdriver/common/manager.rb +11 -38
  64. data/lib/selenium/webdriver/common/options.rb +147 -23
  65. data/lib/selenium/webdriver/common/platform.rb +10 -5
  66. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  67. data/lib/selenium/webdriver/common/profile_helper.rb +11 -9
  68. data/lib/selenium/webdriver/common/proxy.rb +6 -3
  69. data/lib/selenium/webdriver/common/search_context.rb +7 -9
  70. data/lib/selenium/webdriver/common/service.rb +17 -125
  71. data/lib/selenium/webdriver/common/service_manager.rb +150 -0
  72. data/lib/selenium/webdriver/common/shadow_root.rb +87 -0
  73. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  74. data/lib/selenium/webdriver/common/socket_poller.rb +3 -3
  75. data/lib/selenium/webdriver/common/takes_screenshot.rb +66 -0
  76. data/lib/selenium/webdriver/common/target_locator.rb +32 -4
  77. data/lib/selenium/webdriver/common/timeouts.rb +31 -4
  78. data/lib/selenium/webdriver/common/wait.rb +1 -1
  79. data/lib/selenium/webdriver/common/websocket_connection.rb +149 -0
  80. data/lib/selenium/webdriver/common/window.rb +0 -4
  81. data/lib/selenium/webdriver/common/zipper.rb +3 -9
  82. data/lib/selenium/webdriver/common.rb +35 -18
  83. data/lib/selenium/webdriver/devtools/console_event.rb +38 -0
  84. data/lib/selenium/webdriver/devtools/exception_event.rb +36 -0
  85. data/lib/selenium/webdriver/devtools/mutation_event.rb +37 -0
  86. data/lib/selenium/webdriver/devtools/pinned_script.rb +59 -0
  87. data/lib/selenium/webdriver/devtools/request.rb +67 -0
  88. data/lib/selenium/webdriver/devtools/response.rb +66 -0
  89. data/lib/selenium/webdriver/devtools.rb +86 -0
  90. data/lib/selenium/webdriver/edge/driver.rb +7 -29
  91. data/lib/selenium/webdriver/edge/features.rb +45 -0
  92. data/lib/selenium/webdriver/edge/options.rb +11 -48
  93. data/lib/selenium/webdriver/edge/profile.rb +33 -0
  94. data/lib/selenium/webdriver/edge/service.rb +10 -26
  95. data/lib/selenium/webdriver/edge.rb +11 -14
  96. data/lib/selenium/webdriver/firefox/driver.rb +32 -19
  97. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  98. data/lib/selenium/webdriver/firefox/features.rb +63 -0
  99. data/lib/selenium/webdriver/firefox/options.rb +73 -50
  100. data/lib/selenium/webdriver/firefox/profile.rb +16 -70
  101. data/lib/selenium/webdriver/firefox/service.rb +5 -9
  102. data/lib/selenium/webdriver/firefox/util.rb +1 -1
  103. data/lib/selenium/webdriver/firefox.rb +17 -28
  104. data/lib/selenium/webdriver/ie/driver.rb +1 -47
  105. data/lib/selenium/webdriver/ie/options.rb +15 -46
  106. data/lib/selenium/webdriver/ie/service.rb +13 -15
  107. data/lib/selenium/webdriver/ie.rb +3 -16
  108. data/lib/selenium/webdriver/remote/bridge.rb +563 -86
  109. data/lib/selenium/webdriver/remote/capabilities.rb +159 -123
  110. data/lib/selenium/webdriver/remote/commands.rb +158 -0
  111. data/lib/selenium/webdriver/remote/driver.rb +22 -13
  112. data/lib/selenium/webdriver/remote/http/common.rb +0 -5
  113. data/lib/selenium/webdriver/remote/http/default.rb +22 -31
  114. data/lib/selenium/webdriver/remote/response.rb +18 -49
  115. data/lib/selenium/webdriver/remote.rb +15 -12
  116. data/lib/selenium/webdriver/safari/driver.rb +3 -31
  117. data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +3 -3
  118. data/lib/selenium/webdriver/safari/options.rb +10 -29
  119. data/lib/selenium/webdriver/safari/service.rb +4 -8
  120. data/lib/selenium/webdriver/safari.rb +13 -19
  121. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
  122. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +63 -0
  123. data/lib/selenium/webdriver/support/cdp_client_generator.rb +108 -0
  124. data/lib/selenium/webdriver/support/color.rb +9 -9
  125. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  126. data/lib/selenium/webdriver/support/guards/guard.rb +89 -0
  127. data/lib/selenium/webdriver/{firefox/marionette/bridge.rb → support/guards/guard_condition.rb} +22 -19
  128. data/lib/selenium/webdriver/support/guards.rb +95 -0
  129. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  130. data/lib/selenium/webdriver/support/select.rb +3 -3
  131. data/lib/selenium/webdriver/support.rb +1 -0
  132. data/lib/selenium/webdriver/version.rb +1 -1
  133. data/lib/selenium/webdriver.rb +14 -13
  134. data/selenium-webdriver.gemspec +32 -13
  135. metadata +176 -69
  136. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  137. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
  138. data/lib/selenium/webdriver/common/keyboard.rb +0 -70
  139. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  140. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  141. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  142. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  143. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  144. data/lib/selenium/webdriver/firefox/binary.rb +0 -187
  145. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  146. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  147. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  148. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  149. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  150. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  151. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  152. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -60
  153. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  154. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  155. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  156. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  157. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -23,18 +23,18 @@ 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
36
  attr_reader :name, :log_file
37
- attr_writer :secure_ssl, :native_events, :load_no_focus_lib
37
+ attr_writer :secure_ssl, :load_no_focus_lib
38
38
 
39
39
  class << self
40
40
  def ini
@@ -48,10 +48,8 @@ module Selenium
48
48
  raise Error::WebDriverError, "unable to find profile named: #{name.inspect}"
49
49
  end
50
50
 
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
51
+ def decoded(json)
52
+ JSON.parse(json)
55
53
  end
56
54
  end
57
55
 
@@ -70,25 +68,7 @@ module Selenium
70
68
  def initialize(model = nil)
71
69
  @model = verify_model(model)
72
70
 
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
-
71
+ @additional_prefs = read_model_prefs
92
72
  @extensions = {}
93
73
  end
94
74
 
@@ -132,12 +112,6 @@ module Selenium
132
112
  self[WEBDRIVER_PREFS[:log_file]] = file
133
113
  end
134
114
 
135
- def add_webdriver_extension
136
- return if @extensions.key?(:webdriver)
137
-
138
- add_extension(WEBDRIVER_EXTENSION_PATH, :webdriver)
139
- end
140
-
141
115
  #
142
116
  # Add the extension (directory, .zip or .xpi) at the given path to the profile.
143
117
  #
@@ -146,26 +120,6 @@ module Selenium
146
120
  @extensions[name] = Extension.new(path)
147
121
  end
148
122
 
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
123
  def proxy=(proxy)
170
124
  raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}" unless proxy.is_a? Proxy
171
125
 
@@ -189,9 +143,7 @@ module Selenium
189
143
  end
190
144
  end
191
145
 
192
- def encoded
193
- Zipper.zip(layout_on_disk)
194
- end
146
+ alias_method :as_json, :encoded
195
147
 
196
148
  private
197
149
 
@@ -236,17 +188,11 @@ module Selenium
236
188
  def update_user_prefs_in(directory)
237
189
  path = File.join(directory, 'user.js')
238
190
  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?
191
+ prefs.merge! self.class::DEFAULT_PREFERENCES
192
+ prefs.merge!(@additional_prefs)
247
193
 
248
194
  # If the user sets the home page, we should also start up there
249
- prefs['startup.homepage_welcome_url'] = prefs['browser.startup.homepage']
195
+ prefs['startup.homepage_welcome_url'] ||= prefs['browser.startup.homepage']
250
196
 
251
197
  write_prefs prefs, path
252
198
  end
@@ -20,23 +20,19 @@
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
24
+ DEFAULT_PORT = 4444
25
+ EXECUTABLE = 'geckodriver'
26
+ MISSING_TEXT = <<~ERROR
31
27
  Unable to find Mozilla geckodriver. Please download the server from
32
28
  https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH.
33
29
  More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.
34
30
  ERROR
35
- @shutdown_supported = false
31
+ SHUTDOWN_SUPPORTED = false
36
32
 
37
33
  private
38
34
 
39
- # Note: This processing is deprecated
35
+ # NOTE: This processing is deprecated
40
36
  def extract_service_args(driver_opts)
41
37
  driver_args = super
42
38
  driver_opts = driver_opts.dup
@@ -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'
@@ -28,57 +28,11 @@ module Selenium
28
28
  #
29
29
 
30
30
  class Driver < WebDriver::Driver
31
- include DriverExtensions::HasWebStorage
32
- include DriverExtensions::TakesScreenshot
33
-
34
- def initialize(opts = {})
35
- opts[:desired_capabilities] = create_capabilities(opts)
36
-
37
- opts[:url] ||= service_url(opts)
38
-
39
- listener = opts.delete(:listener)
40
- @bridge = Remote::Bridge.handshake(**opts)
41
- super(@bridge, listener: listener)
42
- end
31
+ EXTENSIONS = [DriverExtensions::HasWebStorage].freeze
43
32
 
44
33
  def browser
45
34
  :internet_explorer
46
35
  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
36
  end # Driver
83
37
  end # IE
84
38
  end # WebDriver
@@ -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,32 +39,25 @@ 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'
43
45
  }.freeze
46
+ BROWSER = 'internet explorer'
44
47
 
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
48
+ attr_reader :args
56
49
 
57
50
  #
58
51
  # Create a new Options instance
59
52
  #
60
53
  # @example
61
54
  # options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])
62
- # driver = Selenium::WebDriver.for(:ie, options: options)
55
+ # driver = Selenium::WebDriver.for(:ie, capabilities: options)
63
56
  #
64
57
  # @example
65
58
  # options = Selenium::WebDriver::IE::Options.new
66
59
  # options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM
67
- # driver = Selenium::WebDriver.for(:ie, options: options)
60
+ # driver = Selenium::WebDriver.for(:ie, capabilities: options)
68
61
  #
69
62
  # @param [Hash] opts the pre-defined options
70
63
  # @option opts [Array<String>] args
@@ -86,8 +79,9 @@ module Selenium
86
79
  #
87
80
 
88
81
  def initialize(**opts)
89
- @args = Set.new(opts.delete(:args) || [])
90
- @options = opts
82
+ @args = (opts.delete(:args) || []).to_set
83
+ super(**opts)
84
+
91
85
  @options[:native_events] = true if @options[:native_events].nil?
92
86
  end
93
87
 
@@ -101,36 +95,11 @@ module Selenium
101
95
  @args << arg
102
96
  end
103
97
 
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)
98
+ private
132
99
 
133
- {KEY => generate_as_json(opts)}
100
+ def process_browser_options(browser_options)
101
+ options = browser_options[KEY]
102
+ options['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
134
103
  end
135
104
  end # Options
136
105
  end # IE
@@ -20,31 +20,29 @@
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
24
+ DEFAULT_PORT = 5555
25
+ EXECUTABLE = 'IEDriverServer'
26
+ MISSING_TEXT = <<~ERROR
31
27
  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.
28
+ https://www.selenium.dev/downloads/ and place it somewhere on your PATH.
33
29
  More info at https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.
34
30
  ERROR
35
- @shutdown_supported = true
31
+ SHUTDOWN_SUPPORTED = true
36
32
 
37
33
  private
38
34
 
39
- # Note: This processing is deprecated
35
+ # NOTE: This processing is deprecated
40
36
  def extract_service_args(driver_opts)
41
37
  driver_args = super
42
38
  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)
39
+ driver_args << "--log-level=#{driver_opts[:log_level].to_s.upcase}" if driver_opts.key?(:log_level)
40
+ driver_args << "--log-file=#{driver_opts[:log_file]}" if driver_opts.key?(:log_file)
41
+ if driver_opts.key?(:implementation)
42
+ driver_args << "--implementation=#{driver_opts[:implementation].to_s.upcase}"
43
+ end
44
+ driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
45
+ driver_args << "--extract_path=#{driver_opts[:extract_path]}" if driver_opts.key?(:extract_path)
48
46
  driver_args << "--silent" if driver_opts[:silent] == true
49
47
  driver_args
50
48
  end
@@ -17,25 +17,12 @@
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 :Driver, 'selenium/webdriver/ie/driver'
24
+ autoload :Options, 'selenium/webdriver/ie/options'
25
+ autoload :Service, 'selenium/webdriver/ie/service'
37
26
  end # IE
38
27
  end # WebDriver
39
28
  end # Selenium
40
-
41
- require 'selenium/webdriver/ie/service'