selenium-webdriver 3.142.7 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +611 -5
  3. data/Gemfile +5 -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 +94 -79
  11. data/lib/selenium/webdriver/atoms/findElements.js +121 -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 +128 -238
  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 +47 -0
  64. data/lib/selenium/webdriver/common/element.rb +89 -29
  65. data/lib/selenium/webdriver/common/error.rb +53 -194
  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 +119 -19
  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 +8 -5
  95. data/lib/selenium/webdriver/common/search_context.rb +7 -9
  96. data/lib/selenium/webdriver/common/selenium_manager.rb +125 -0
  97. data/lib/selenium/webdriver/common/service.rb +26 -137
  98. data/lib/selenium/webdriver/common/service_manager.rb +144 -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 +4 -4
  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 +18 -43
  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 +17 -71
  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 +592 -87
  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 +3 -8
  144. data/lib/selenium/webdriver/remote/http/curb.rb +1 -3
  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 +13 -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 +24 -24
  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 +18 -17
  164. data/selenium-webdriver.gemspec +36 -18
  165. metadata +159 -89
  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
@@ -1,187 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
- # @api private
24
- class Binary
25
- NO_FOCUS_LIBRARY_NAME = 'x_ignore_nofocus.so'
26
- NO_FOCUS_LIBRARIES = [
27
- ["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/amd64/#{NO_FOCUS_LIBRARY_NAME}",
28
- "amd64/#{NO_FOCUS_LIBRARY_NAME}"],
29
- ["#{WebDriver.root}/selenium/webdriver/firefox/native/linux/x86/#{NO_FOCUS_LIBRARY_NAME}",
30
- "x86/#{NO_FOCUS_LIBRARY_NAME}"]
31
- ].freeze
32
-
33
- WAIT_TIMEOUT = 90
34
- QUIT_TIMEOUT = 5
35
-
36
- def start_with(profile, profile_path, *args)
37
- if Platform.cygwin?
38
- profile_path = Platform.cygwin_path(profile_path, windows: true)
39
- elsif Platform.windows?
40
- profile_path = Platform.windows_path(profile_path)
41
- end
42
-
43
- ENV['XRE_CONSOLE_LOG'] = profile.log_file if profile.log_file
44
- ENV['XRE_PROFILE_PATH'] = profile_path
45
- ENV['MOZ_NO_REMOTE'] = '1' # able to launch multiple instances
46
- ENV['MOZ_CRASHREPORTER_DISABLE'] = '1' # disable breakpad
47
- ENV['NO_EM_RESTART'] = '1' # prevent the binary from detaching from the console
48
-
49
- modify_link_library_path profile_path if Platform.linux? && (profile.native_events? || profile.load_no_focus_lib?)
50
-
51
- execute(*args)
52
- end
53
-
54
- def quit
55
- return unless @process
56
-
57
- @process.poll_for_exit QUIT_TIMEOUT
58
- rescue ChildProcess::TimeoutError
59
- # ok, force quit
60
- @process.stop QUIT_TIMEOUT
61
- end
62
-
63
- def wait
64
- return unless @process
65
-
66
- begin
67
- @process.poll_for_exit(WAIT_TIMEOUT)
68
- rescue ChildProcess::TimeoutError => e
69
- @process.stop
70
- raise e
71
- end
72
- end
73
-
74
- private
75
-
76
- def execute(*extra_args)
77
- args = [self.class.path, '-no-remote'] + extra_args
78
- @process = ChildProcess.build(*args)
79
- WebDriver.logger.debug("Executing Process #{args}")
80
-
81
- @process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
82
- @process.start
83
- end
84
-
85
- def modify_link_library_path(profile_path)
86
- paths = []
87
-
88
- NO_FOCUS_LIBRARIES.each do |from, to|
89
- dest = File.join(profile_path, to)
90
- FileUtils.mkdir_p File.dirname(dest)
91
- FileUtils.cp from, dest
92
-
93
- paths << File.expand_path(File.dirname(dest))
94
- end
95
-
96
- paths += ENV['LD_LIBRARY_PATH'].to_s.split(File::PATH_SEPARATOR)
97
-
98
- ENV['LD_LIBRARY_PATH'] = paths.uniq.join(File::PATH_SEPARATOR)
99
- ENV['LD_PRELOAD'] = NO_FOCUS_LIBRARY_NAME
100
- end
101
-
102
- class << self
103
- #
104
- # @api private
105
- #
106
- # @see Firefox.path=
107
- #
108
-
109
- def path=(path)
110
- Platform.assert_executable(path)
111
- @path = path
112
- end
113
-
114
- def reset_path!
115
- @path = nil
116
- end
117
-
118
- def path
119
- @path ||= case Platform.os
120
- when :macosx
121
- macosx_path
122
- when :windows
123
- windows_path
124
- when :linux, :unix
125
- Platform.find_binary('firefox3', 'firefox2', 'firefox') || '/usr/bin/firefox'
126
- else
127
- raise Error::WebDriverError, "unknown platform: #{Platform.os}"
128
- end
129
-
130
- @path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
131
-
132
- unless File.file?(@path.to_s)
133
- error = "Could not find Firefox binary (os=#{Platform.os}). " \
134
- "Make sure Firefox is installed or set the path manually with #{self}.path="
135
- raise Error::WebDriverError, error
136
- end
137
-
138
- @path
139
- end
140
-
141
- def version
142
- @version = case Platform.os
143
- when :macosx
144
- `#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
145
- when :windows
146
- `\"#{path}\" -v | more`.strip[/[^\s]*$/][/^\d+/].to_i
147
- when :linux
148
- `#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
149
- else
150
- 0
151
- end
152
- end
153
-
154
- private
155
-
156
- def windows_path
157
- windows_registry_path ||
158
- Platform.find_in_program_files('\\Mozilla Firefox\\firefox.exe') ||
159
- Platform.find_binary('firefox')
160
- end
161
-
162
- def macosx_path
163
- path = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
164
- path = File.expand_path('~/Applications/Firefox.app/Contents/MacOS/firefox-bin') unless File.exist?(path)
165
- path = Platform.find_binary('firefox-bin') unless File.exist?(path)
166
-
167
- path
168
- end
169
-
170
- def windows_registry_path
171
- require 'win32/registry'
172
-
173
- lm = Win32::Registry::HKEY_LOCAL_MACHINE
174
- lm.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|
175
- main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
176
- entry = main.find { |key, _type, _data| key =~ /pathtoexe/i }
177
- return entry.last if entry
178
- end
179
- rescue LoadError
180
- # older JRuby or IronRuby does not have win32/registry
181
- rescue Win32::Registry::Error
182
- end
183
- end # class << self
184
- end # Binary
185
- end # Firefox
186
- end # WebDriver
187
- end # Selenium
@@ -1,69 +0,0 @@
1
- {
2
- "frozen": {
3
- "app.update.auto": false,
4
- "app.update.enabled": false,
5
- "browser.displayedE10SNotice": 4,
6
- "browser.download.manager.showWhenStarting": false,
7
- "browser.EULA.override": true,
8
- "browser.EULA.3.accepted": true,
9
- "browser.link.open_external": 2,
10
- "browser.link.open_newwindow": 2,
11
- "browser.offline": false,
12
- "browser.reader.detectedFirstArticle": true,
13
- "browser.safebrowsing.enabled": false,
14
- "browser.safebrowsing.malware.enabled": false,
15
- "browser.search.update": false,
16
- "browser.selfsupport.url" : "",
17
- "browser.sessionstore.resume_from_crash": false,
18
- "browser.shell.checkDefaultBrowser": false,
19
- "browser.tabs.warnOnClose": false,
20
- "browser.tabs.warnOnOpen": false,
21
- "datareporting.healthreport.service.enabled": false,
22
- "datareporting.healthreport.uploadEnabled": false,
23
- "datareporting.healthreport.service.firstRun": false,
24
- "datareporting.healthreport.logging.consoleEnabled": false,
25
- "datareporting.policy.dataSubmissionEnabled": false,
26
- "datareporting.policy.dataSubmissionPolicyAccepted": false,
27
- "devtools.errorconsole.enabled": true,
28
- "dom.disable_open_during_load": false,
29
- "extensions.autoDisableScopes": 10,
30
- "extensions.blocklist.enabled": false,
31
- "extensions.checkCompatibility.nightly": false,
32
- "extensions.update.enabled": false,
33
- "extensions.update.notifyUser": false,
34
- "javascript.enabled": true,
35
- "network.manage-offline-status": false,
36
- "network.http.phishy-userpass-length": 255,
37
- "offline-apps.allow_by_default": true,
38
- "prompts.tab_modal.enabled": false,
39
- "security.fileuri.origin_policy": 3,
40
- "security.fileuri.strict_origin_policy": false,
41
- "signon.rememberSignons": false,
42
- "toolkit.networkmanager.disable": true,
43
- "toolkit.telemetry.prompted": 2,
44
- "toolkit.telemetry.enabled": false,
45
- "toolkit.telemetry.rejected": true,
46
- "xpinstall.signatures.required": false,
47
- "xpinstall.whitelist.required": false
48
- },
49
- "mutable": {
50
- "browser.dom.window.dump.enabled": true,
51
- "browser.laterrun.enabled": false,
52
- "browser.newtab.url": "about:blank",
53
- "browser.newtabpage.enabled": false,
54
- "browser.startup.page": 0,
55
- "browser.startup.homepage": "about:blank",
56
- "browser.startup.homepage_override.mstone": "ignore",
57
- "browser.usedOnWindows10.introURL": "about:blank",
58
- "dom.max_chrome_script_run_time": 30,
59
- "dom.max_script_run_time": 30,
60
- "dom.report_all_js_exceptions": true,
61
- "javascript.options.showInConsole": true,
62
- "network.captive-portal-service.enabled": false,
63
- "security.csp.enable": false,
64
- "startup.homepage_welcome_url": "about:blank",
65
- "startup.homepage_welcome_url.additional": "about:blank",
66
- "webdriver_accept_untrusted_certs": true,
67
- "webdriver_assume_untrusted_issuer": true
68
- }
69
- }
@@ -1,111 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
- # @api private
24
- class Launcher
25
- SOCKET_LOCK_TIMEOUT = 45
26
- STABLE_CONNECTION_TIMEOUT = 60
27
-
28
- def initialize(binary, port, profile = nil)
29
- @binary = binary
30
- @port = Integer(port)
31
-
32
- raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
33
-
34
- if profile.is_a? Profile
35
- @profile = profile
36
- else
37
- @profile_name = profile
38
- @profile = nil
39
- end
40
-
41
- @host = '127.0.0.1'
42
- end
43
-
44
- def url
45
- "http://#{@host}:#{@port}/hub"
46
- end
47
-
48
- def launch
49
- socket_lock.locked do
50
- find_free_port
51
- create_profile
52
- start
53
- connect_until_stable
54
- end
55
-
56
- self
57
- end
58
-
59
- def quit
60
- @binary.quit
61
- FileReaper.reap(@profile_dir) if @profile_dir
62
- end
63
-
64
- def find_free_port
65
- @port = PortProber.above @port
66
- end
67
-
68
- def create_profile
69
- fetch_profile unless @profile
70
-
71
- @profile.add_webdriver_extension
72
- @profile.port = @port
73
-
74
- @profile_dir = @profile.layout_on_disk
75
- FileReaper << @profile_dir
76
- end
77
-
78
- def start
79
- assert_profile
80
- @binary.start_with @profile, @profile_dir, '-foreground'
81
- end
82
-
83
- def connect_until_stable
84
- poller = SocketPoller.new(@host, @port, STABLE_CONNECTION_TIMEOUT)
85
-
86
- return if poller.connected?
87
-
88
- @binary.quit
89
- error = "unable to obtain stable firefox connection in #{STABLE_CONNECTION_TIMEOUT} seconds (#{@host}:#{@port})"
90
- raise Error::WebDriverError, error
91
- end
92
-
93
- def fetch_profile
94
- @profile = if @profile_name
95
- Profile.from_name @profile_name
96
- else
97
- Profile.new
98
- end
99
- end
100
-
101
- def assert_profile
102
- raise Error::WebDriverError, 'must create_profile first' unless @profile && @profile_dir
103
- end
104
-
105
- def socket_lock
106
- @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
107
- end
108
- end # Launcher
109
- end # Firefox
110
- end # WebDriver
111
- end # Selenium
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
- module Legacy
24
-
25
- #
26
- # Driver implementation for Firefox using legacy extension.
27
- # @api private
28
- #
29
-
30
- class Driver < WebDriver::Driver
31
- include DriverExtensions::TakesScreenshot
32
-
33
- def initialize(opts = {}) # rubocop:disable Metrics/AbcSize
34
- WebDriver.logger.deprecate 'Selenium support for legacy Firefox', 'Firefox via marionette'
35
-
36
- opts[:desired_capabilities] ||= Remote::Capabilities.firefox_legacy
37
-
38
- if opts.key? :proxy
39
- WebDriver.logger.deprecate ':proxy', "Selenium::WebDriver::Remote::Capabilities.firefox(proxy: #{opts[:proxy]})"
40
- opts[:desired_capabilities].proxy = opts.delete(:proxy)
41
- end
42
-
43
- unless opts.key?(:url)
44
- port = opts.delete(:port) || DEFAULT_PORT
45
- profile = opts.delete(:profile)
46
-
47
- Binary.path = opts[:desired_capabilities][:firefox_binary] if opts[:desired_capabilities][:firefox_binary]
48
- @launcher = Launcher.new Binary.new, port, profile
49
- @launcher.launch
50
- opts[:url] = @launcher.url
51
- end
52
-
53
- listener = opts.delete(:listener)
54
- WebDriver.logger.info 'Skipping handshake as we know it is OSS.'
55
- desired_capabilities = opts.delete(:desired_capabilities)
56
- bridge = Remote::Bridge.new(opts)
57
- capabilities = bridge.create_session(desired_capabilities)
58
- @bridge = Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)
59
-
60
- begin
61
- super(@bridge, listener: listener)
62
- rescue
63
- @launcher&.quit
64
- raise
65
- end
66
- end
67
-
68
- def browser
69
- :firefox
70
- end
71
-
72
- def quit
73
- super
74
- nil
75
- ensure
76
- @launcher.quit
77
- end
78
-
79
- end # Driver
80
- end # Legacy
81
- end # Firefox
82
- end # WebDriver
83
- end # Selenium
@@ -1,90 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
- module Marionette
24
-
25
- #
26
- # Driver implementation for Firefox using GeckoDriver.
27
- # @api private
28
- #
29
-
30
- class Driver < WebDriver::Driver
31
- include DriverExtensions::HasAddons
32
- include DriverExtensions::HasWebStorage
33
- include DriverExtensions::TakesScreenshot
34
-
35
- def initialize(opts = {})
36
- opts[:desired_capabilities] = create_capabilities(opts)
37
-
38
- opts[:url] ||= service_url(opts)
39
-
40
- listener = opts.delete(:listener)
41
- WebDriver.logger.info 'Skipping handshake as we know it is W3C.'
42
- desired_capabilities = opts.delete(:desired_capabilities)
43
- bridge = Remote::Bridge.new(opts)
44
- capabilities = bridge.create_session(desired_capabilities)
45
- @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
46
- @bridge.extend Marionette::Bridge
47
-
48
- super(@bridge, listener: listener)
49
- end
50
-
51
- def browser
52
- :firefox
53
- end
54
-
55
- def quit
56
- super
57
- ensure
58
- @service&.stop
59
- end
60
-
61
- private
62
-
63
- def create_capabilities(opts)
64
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.firefox }
65
- options = opts.delete(:options) { Options.new }
66
-
67
- firefox_options = opts.delete(:firefox_options)
68
- if firefox_options
69
- WebDriver.logger.deprecate ':firefox_options', 'Selenium::WebDriver::Firefox::Options'
70
- firefox_options.each do |key, value|
71
- options.add_option(key, value)
72
- end
73
- end
74
-
75
- profile = opts.delete(:profile)
76
- if profile
77
- WebDriver.logger.deprecate ':profile', 'Selenium::WebDriver::Firefox::Options#profile='
78
- options.profile = profile
79
- end
80
-
81
- options = options.as_json
82
- caps.merge!(options) unless options.empty?
83
-
84
- caps
85
- end
86
- end # Driver
87
- end # Marionette
88
- end # Firefox
89
- end # WebDriver
90
- end # Selenium
@@ -1,60 +0,0 @@
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
- require 'net/http/persistent'
21
-
22
- module Selenium
23
- module WebDriver
24
- module Remote
25
- module Http
26
- # @api private
27
- class Persistent < Default
28
- def close
29
- @http&.shutdown
30
- end
31
-
32
- private
33
-
34
- def new_http_client
35
- proxy = nil
36
-
37
- if @proxy
38
- unless @proxy.respond_to?(:http)
39
- url = @proxy.http
40
- raise Error::WebDriverError, "expected HTTP proxy, got #{@proxy.inspect}" unless url
41
- end
42
- proxy = URI.parse(url)
43
- end
44
-
45
- if Net::HTTP::Persistent::VERSION >= '3'
46
- Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
47
- else
48
- WebDriver.logger.warn 'Support for this version of net-http-persistent is deprecated. Please upgrade.'
49
- Net::HTTP::Persistent.new 'webdriver', proxy
50
- end
51
- end
52
-
53
- def response_for(request)
54
- http.request server_url, request
55
- end
56
- end # Persistent
57
- end # Http
58
- end # Remote
59
- end # WebDriver
60
- end # Selenium