selenium-webdriver 3.142.7 → 4.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +583 -5
  3. data/Gemfile +3 -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 -78
  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 +76 -78
  14. data/lib/selenium/webdriver/atoms/mutationListener.js +55 -0
  15. data/lib/selenium/webdriver/atoms.rb +2 -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 +44 -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 +6 -33
  32. data/lib/selenium/webdriver/chrome.rb +5 -18
  33. data/lib/selenium/webdriver/chromium/driver.rb +61 -0
  34. data/lib/selenium/webdriver/{chrome/bridge.rb → chromium/features.rb} +51 -16
  35. data/lib/selenium/webdriver/chromium/options.rb +261 -0
  36. data/lib/selenium/webdriver/chromium/profile.rb +113 -0
  37. data/lib/selenium/webdriver/chromium/service.rb +42 -0
  38. data/lib/selenium/webdriver/chromium.rb +32 -0
  39. data/lib/selenium/webdriver/common/action_builder.rb +135 -237
  40. data/lib/selenium/webdriver/common/child_process.rb +124 -0
  41. data/lib/selenium/webdriver/common/driver.rb +94 -43
  42. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
  43. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +42 -0
  44. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  45. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +49 -0
  46. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +87 -0
  47. data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_bidi.rb} +9 -9
  48. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +86 -0
  49. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +36 -0
  50. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +42 -0
  51. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
  52. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +41 -0
  53. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +36 -0
  54. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +5 -9
  55. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +143 -0
  56. data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_logs.rb} +4 -4
  57. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +16 -1
  58. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +6 -27
  59. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +69 -0
  60. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +11 -13
  61. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +75 -0
  62. data/lib/selenium/webdriver/common/driver_extensions/{rotatable.rb → prints_page.rb} +18 -20
  63. data/lib/selenium/webdriver/common/driver_finder.rb +43 -0
  64. data/lib/selenium/webdriver/common/element.rb +89 -29
  65. data/lib/selenium/webdriver/common/error.rb +32 -198
  66. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
  67. data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
  68. data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -22
  69. data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
  70. data/lib/selenium/webdriver/common/interactions/key_actions.rb +10 -6
  71. data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
  72. data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
  73. data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
  74. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +71 -82
  75. data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
  76. data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
  77. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
  78. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
  79. data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
  80. data/lib/selenium/webdriver/common/interactions/scroll.rb +59 -0
  81. data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
  82. data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
  83. data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
  84. data/lib/selenium/webdriver/common/{w3c_manager.rb → interactions/wheel_input.rb} +14 -17
  85. data/lib/selenium/webdriver/common/keys.rb +1 -0
  86. data/lib/selenium/webdriver/common/local_driver.rb +55 -0
  87. data/lib/selenium/webdriver/common/log_entry.rb +2 -2
  88. data/lib/selenium/webdriver/common/logger.rb +58 -15
  89. data/lib/selenium/webdriver/common/manager.rb +11 -38
  90. data/lib/selenium/webdriver/common/options.rb +169 -23
  91. data/lib/selenium/webdriver/common/platform.rb +14 -6
  92. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  93. data/lib/selenium/webdriver/common/profile_helper.rb +11 -9
  94. data/lib/selenium/webdriver/common/proxy.rb +7 -4
  95. data/lib/selenium/webdriver/common/search_context.rb +7 -9
  96. data/lib/selenium/webdriver/common/selenium_manager.rb +108 -0
  97. data/lib/selenium/webdriver/common/service.rb +17 -136
  98. data/lib/selenium/webdriver/common/service_manager.rb +142 -0
  99. data/lib/selenium/webdriver/common/shadow_root.rb +86 -0
  100. data/lib/selenium/webdriver/common/socket_lock.rb +4 -4
  101. data/lib/selenium/webdriver/common/socket_poller.rb +3 -3
  102. data/lib/selenium/webdriver/common/takes_screenshot.rb +65 -0
  103. data/lib/selenium/webdriver/common/target_locator.rb +31 -4
  104. data/lib/selenium/webdriver/common/timeouts.rb +31 -4
  105. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +85 -0
  106. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +72 -0
  107. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
  108. data/lib/selenium/webdriver/common/wait.rb +1 -1
  109. data/lib/selenium/webdriver/common/websocket_connection.rb +164 -0
  110. data/lib/selenium/webdriver/common/window.rb +6 -10
  111. data/lib/selenium/webdriver/common/zipper.rb +4 -10
  112. data/lib/selenium/webdriver/common.rb +42 -18
  113. data/lib/selenium/webdriver/devtools/console_event.rb +36 -0
  114. data/lib/selenium/webdriver/devtools/exception_event.rb +34 -0
  115. data/lib/selenium/webdriver/devtools/mutation_event.rb +35 -0
  116. data/lib/selenium/webdriver/devtools/network_interceptor.rb +173 -0
  117. data/lib/selenium/webdriver/devtools/pinned_script.rb +57 -0
  118. data/lib/selenium/webdriver/devtools/request.rb +65 -0
  119. data/lib/selenium/webdriver/devtools/response.rb +64 -0
  120. data/lib/selenium/webdriver/devtools.rb +96 -0
  121. data/lib/selenium/webdriver/edge/driver.rb +11 -27
  122. data/lib/selenium/webdriver/edge/features.rb +44 -0
  123. data/lib/selenium/webdriver/edge/options.rb +10 -49
  124. data/lib/selenium/webdriver/edge/profile.rb +33 -0
  125. data/lib/selenium/webdriver/edge/service.rb +7 -27
  126. data/lib/selenium/webdriver/edge.rb +11 -14
  127. data/lib/selenium/webdriver/firefox/driver.rb +38 -19
  128. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  129. data/lib/selenium/webdriver/firefox/features.rb +66 -0
  130. data/lib/selenium/webdriver/firefox/options.rb +77 -50
  131. data/lib/selenium/webdriver/firefox/profile.rb +16 -70
  132. data/lib/selenium/webdriver/firefox/service.rb +3 -13
  133. data/lib/selenium/webdriver/firefox/util.rb +1 -1
  134. data/lib/selenium/webdriver/firefox.rb +17 -28
  135. data/lib/selenium/webdriver/ie/driver.rb +5 -45
  136. data/lib/selenium/webdriver/ie/options.rb +15 -46
  137. data/lib/selenium/webdriver/ie/service.rb +11 -19
  138. data/lib/selenium/webdriver/ie.rb +3 -16
  139. data/lib/selenium/webdriver/remote/bridge/commands.rb +170 -0
  140. data/lib/selenium/webdriver/remote/bridge.rb +590 -86
  141. data/lib/selenium/webdriver/remote/capabilities.rb +182 -124
  142. data/lib/selenium/webdriver/remote/driver.rb +30 -15
  143. data/lib/selenium/webdriver/remote/http/common.rb +0 -5
  144. data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
  145. data/lib/selenium/webdriver/remote/http/default.rb +23 -31
  146. data/lib/selenium/webdriver/remote/response.rb +17 -49
  147. data/lib/selenium/webdriver/remote.rb +14 -12
  148. data/lib/selenium/webdriver/safari/driver.rb +7 -29
  149. data/lib/selenium/webdriver/safari/{bridge.rb → features.rb} +3 -5
  150. data/lib/selenium/webdriver/safari/options.rb +12 -27
  151. data/lib/selenium/webdriver/safari/service.rb +3 -11
  152. data/lib/selenium/webdriver/safari.rb +14 -20
  153. data/lib/selenium/webdriver/support/block_event_listener.rb +1 -1
  154. data/lib/selenium/webdriver/support/color.rb +22 -22
  155. data/lib/selenium/webdriver/support/event_firing_bridge.rb +4 -4
  156. data/lib/selenium/webdriver/support/guards/guard.rb +87 -0
  157. data/lib/selenium/webdriver/{firefox/marionette/bridge.rb → support/guards/guard_condition.rb} +21 -20
  158. data/lib/selenium/webdriver/support/guards.rb +95 -0
  159. data/lib/selenium/webdriver/support/relative_locator.rb +50 -0
  160. data/lib/selenium/webdriver/support/select.rb +6 -4
  161. data/lib/selenium/webdriver/support.rb +1 -0
  162. data/lib/selenium/webdriver/version.rb +1 -1
  163. data/lib/selenium/webdriver.rb +17 -17
  164. data/selenium-webdriver.gemspec +36 -18
  165. metadata +164 -94
  166. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  167. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +0 -64
  168. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  169. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  170. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  171. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  172. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  173. data/lib/selenium/webdriver/firefox/binary.rb +0 -187
  174. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  175. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  176. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  177. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  178. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  179. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  180. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  181. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -60
  182. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  183. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  184. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  185. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  186. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -20,23 +20,13 @@
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
24
+ DEFAULT_PORT = 4444
25
+ EXECUTABLE = 'geckodriver'
26
+ SHUTDOWN_SUPPORTED = false
36
27
 
37
28
  private
38
29
 
39
- # Note: This processing is deprecated
40
30
  def extract_service_args(driver_opts)
41
31
  driver_args = super
42
32
  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'
@@ -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(capabilities: nil, options: nil, service: nil, url: nil, **opts)
35
+ caps, url = initialize_local_driver(capabilities, 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
@@ -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,32 +20,24 @@
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
24
+ DEFAULT_PORT = 5555
25
+ EXECUTABLE = 'IEDriverServer'
26
+ SHUTDOWN_SUPPORTED = true
36
27
 
37
28
  private
38
29
 
39
- # Note: This processing is deprecated
40
30
  def extract_service_args(driver_opts)
41
31
  driver_args = super
42
32
  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
33
+ driver_args << "--log-level=#{driver_opts[:log_level].to_s.upcase}" if driver_opts.key?(:log_level)
34
+ driver_args << "--log-file=#{driver_opts[:log_file]}" if driver_opts.key?(:log_file)
35
+ if driver_opts.key?(:implementation)
36
+ driver_args << "--implementation=#{driver_opts[:implementation].to_s.upcase}"
37
+ end
38
+ driver_args << "--host=#{driver_opts[:host]}" if driver_opts.key?(:host)
39
+ driver_args << "--extract_path=#{driver_opts[:extract_path]}" if driver_opts.key?(:extract_path)
40
+ driver_args << '--silent' if driver_opts[:silent] == true
49
41
  driver_args
50
42
  end
51
43
  end # Server
@@ -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'
@@ -0,0 +1,170 @@
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 Remote
23
+ #
24
+ # https://w3c.github.io/webdriver/#endpoints
25
+ # @api private
26
+ #
27
+
28
+ class Bridge
29
+ COMMANDS = {
30
+ status: [:get, 'status'],
31
+
32
+ #
33
+ # session handling
34
+ #
35
+
36
+ new_session: [:post, 'session'],
37
+ delete_session: [:delete, 'session/:session_id'],
38
+
39
+ #
40
+ # basic driver
41
+ #
42
+
43
+ get: [:post, 'session/:session_id/url'],
44
+ get_current_url: [:get, 'session/:session_id/url'],
45
+ back: [:post, 'session/:session_id/back'],
46
+ forward: [:post, 'session/:session_id/forward'],
47
+ refresh: [:post, 'session/:session_id/refresh'],
48
+ get_title: [:get, 'session/:session_id/title'],
49
+
50
+ #
51
+ # window and Frame handling
52
+ #
53
+
54
+ get_window_handle: [:get, 'session/:session_id/window'],
55
+ new_window: [:post, 'session/:session_id/window/new'],
56
+ close_window: [:delete, 'session/:session_id/window'],
57
+ switch_to_window: [:post, 'session/:session_id/window'],
58
+ get_window_handles: [:get, 'session/:session_id/window/handles'],
59
+ fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
60
+ minimize_window: [:post, 'session/:session_id/window/minimize'],
61
+ maximize_window: [:post, 'session/:session_id/window/maximize'],
62
+ set_window_rect: [:post, 'session/:session_id/window/rect'],
63
+ get_window_rect: [:get, 'session/:session_id/window/rect'],
64
+ switch_to_frame: [:post, 'session/:session_id/frame'],
65
+ switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
66
+
67
+ #
68
+ # element
69
+ #
70
+
71
+ find_element: [:post, 'session/:session_id/element'],
72
+ find_elements: [:post, 'session/:session_id/elements'],
73
+ find_child_element: [:post, 'session/:session_id/element/:id/element'],
74
+ find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
75
+ find_shadow_child_element: [:post, 'session/:session_id/shadow/:id/element'],
76
+ find_shadow_child_elements: [:post, 'session/:session_id/shadow/:id/elements'],
77
+ get_active_element: [:get, 'session/:session_id/element/active'],
78
+ get_element_shadow_root: [:get, 'session/:session_id/element/:id/shadow'],
79
+ is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
80
+ get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
81
+ get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
82
+ get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
83
+ get_element_aria_role: [:get, 'session/:session_id/element/:id/computedrole'],
84
+ get_element_aria_label: [:get, 'session/:session_id/element/:id/computedlabel'],
85
+ get_element_text: [:get, 'session/:session_id/element/:id/text'],
86
+ get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
87
+ get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
88
+ is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
89
+
90
+ #
91
+ # document handling
92
+ #
93
+
94
+ get_page_source: [:get, 'session/:session_id/source'],
95
+ execute_script: [:post, 'session/:session_id/execute/sync'],
96
+ execute_async_script: [:post, 'session/:session_id/execute/async'],
97
+
98
+ #
99
+ # cookies
100
+ #
101
+
102
+ get_all_cookies: [:get, 'session/:session_id/cookie'],
103
+ get_cookie: [:get, 'session/:session_id/cookie/:name'],
104
+ add_cookie: [:post, 'session/:session_id/cookie'],
105
+ delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
106
+ delete_all_cookies: [:delete, 'session/:session_id/cookie'],
107
+
108
+ #
109
+ # timeouts
110
+ #
111
+
112
+ get_timeouts: [:get, 'session/:session_id/timeouts'],
113
+ set_timeout: [:post, 'session/:session_id/timeouts'],
114
+
115
+ #
116
+ # actions
117
+ #
118
+
119
+ actions: [:post, 'session/:session_id/actions'],
120
+ release_actions: [:delete, 'session/:session_id/actions'],
121
+ print_page: [:post, 'session/:session_id/print'],
122
+
123
+ #
124
+ # Element Operations
125
+ #
126
+
127
+ element_click: [:post, 'session/:session_id/element/:id/click'],
128
+ element_clear: [:post, 'session/:session_id/element/:id/clear'],
129
+ element_send_keys: [:post, 'session/:session_id/element/:id/value'],
130
+
131
+ #
132
+ # alerts
133
+ #
134
+
135
+ dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
136
+ accept_alert: [:post, 'session/:session_id/alert/accept'],
137
+ get_alert_text: [:get, 'session/:session_id/alert/text'],
138
+ send_alert_text: [:post, 'session/:session_id/alert/text'],
139
+
140
+ #
141
+ # screenshot
142
+ #
143
+
144
+ take_screenshot: [:get, 'session/:session_id/screenshot'],
145
+ take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
146
+
147
+ #
148
+ # server extensions
149
+ #
150
+
151
+ upload_file: [:post, 'session/:session_id/se/file'],
152
+
153
+ #
154
+ # virtual-authenticator
155
+ #
156
+
157
+ add_virtual_authenticator: [:post, 'session/:session_id/webauthn/authenticator'],
158
+ remove_virtual_authenticator: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId'],
159
+ add_credential: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/credential'],
160
+ get_credentials: [:get, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
161
+ remove_credential: [:delete,
162
+ 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials/:credentialId'],
163
+ remove_all_credentials: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
164
+ set_user_verified: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/uv']
165
+
166
+ }.freeze
167
+ end # Bridge
168
+ end # Remote
169
+ end # WebDriver
170
+ end # Selenium