selenium-webdriver 4.5.0 → 4.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +219 -1
- data/Gemfile +3 -0
- data/LICENSE +1 -1
- data/NOTICE +1 -1
- data/README.md +2 -2
- data/bin/linux/selenium-manager +0 -0
- data/bin/macos/selenium-manager +0 -0
- data/bin/windows/selenium-manager.exe +0 -0
- data/lib/selenium/server.rb +8 -22
- data/lib/selenium/webdriver/atoms/findElements.js +5 -5
- data/lib/selenium/webdriver/atoms/getAttribute.js +0 -0
- data/lib/selenium/webdriver/atoms/isDisplayed.js +2 -1
- data/lib/selenium/webdriver/atoms/mutationListener.js +0 -0
- data/lib/selenium/webdriver/atoms.rb +5 -3
- data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
- data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
- data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
- data/lib/selenium/webdriver/{common/driver_extensions/has_location.rb → bidi/log/filter_by.rb} +14 -11
- data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
- data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
- data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
- data/lib/selenium/webdriver/bidi/session.rb +13 -0
- data/lib/selenium/webdriver/bidi.rb +3 -2
- data/lib/selenium/webdriver/chrome/driver.rb +9 -30
- data/lib/selenium/webdriver/chrome/features.rb +8 -71
- data/lib/selenium/webdriver/chrome/options.rb +3 -237
- data/lib/selenium/webdriver/chrome/profile.rb +3 -83
- data/lib/selenium/webdriver/chrome/service.rb +4 -19
- data/lib/selenium/webdriver/chrome.rb +0 -2
- data/lib/selenium/webdriver/chromium/driver.rb +60 -0
- data/lib/selenium/webdriver/chromium/features.rb +99 -0
- data/lib/selenium/webdriver/chromium/options.rb +243 -0
- data/lib/selenium/webdriver/chromium/profile.rb +113 -0
- data/lib/selenium/webdriver/chromium.rb +29 -0
- data/lib/selenium/webdriver/common/action_builder.rb +11 -58
- data/lib/selenium/webdriver/common/child_process.rb +124 -0
- data/lib/selenium/webdriver/common/driver.rb +19 -36
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_bidi.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_file_downloads.rb +65 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +0 -1
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
- data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +0 -2
- data/lib/selenium/webdriver/common/driver_finder.rb +45 -0
- data/lib/selenium/webdriver/common/element.rb +6 -6
- data/lib/selenium/webdriver/common/error.rb +27 -4
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +3 -3
- data/lib/selenium/webdriver/common/interactions/pointer_move.rb +2 -2
- data/lib/selenium/webdriver/common/interactions/scroll.rb +7 -5
- data/lib/selenium/webdriver/common/local_driver.rb +46 -0
- data/lib/selenium/webdriver/common/logger.rb +91 -26
- data/lib/selenium/webdriver/common/options.rb +15 -8
- data/lib/selenium/webdriver/common/platform.rb +8 -49
- data/lib/selenium/webdriver/common/port_prober.rb +1 -1
- data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
- data/lib/selenium/webdriver/common/proxy.rb +2 -2
- data/lib/selenium/webdriver/common/selenium_manager.rb +140 -0
- data/lib/selenium/webdriver/common/service.rb +21 -30
- data/lib/selenium/webdriver/common/service_manager.rb +6 -12
- data/lib/selenium/webdriver/common/shadow_root.rb +1 -2
- data/lib/selenium/webdriver/common/socket_lock.rb +3 -3
- data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
- data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
- data/lib/selenium/webdriver/common/target_locator.rb +2 -3
- data/lib/selenium/webdriver/common/timeouts.rb +2 -2
- data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +8 -6
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +0 -1
- data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +16 -16
- data/lib/selenium/webdriver/common/websocket_connection.rb +12 -4
- data/lib/selenium/webdriver/common.rb +5 -2
- data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
- data/lib/selenium/webdriver/devtools/network_interceptor.rb +4 -7
- data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
- data/lib/selenium/webdriver/devtools/request.rb +0 -2
- data/lib/selenium/webdriver/devtools/response.rb +0 -2
- data/lib/selenium/webdriver/devtools.rb +11 -2
- data/lib/selenium/webdriver/edge/driver.rb +9 -3
- data/lib/selenium/webdriver/edge/features.rb +7 -4
- data/lib/selenium/webdriver/edge/options.rb +17 -5
- data/lib/selenium/webdriver/edge/profile.rb +2 -2
- data/lib/selenium/webdriver/edge/service.rb +8 -7
- data/lib/selenium/webdriver/edge.rb +0 -2
- data/lib/selenium/webdriver/firefox/driver.rb +8 -2
- data/lib/selenium/webdriver/firefox/features.rb +5 -2
- data/lib/selenium/webdriver/firefox/options.rb +2 -14
- data/lib/selenium/webdriver/firefox/profile.rb +10 -8
- data/lib/selenium/webdriver/firefox/service.rb +0 -18
- data/lib/selenium/webdriver/ie/driver.rb +7 -1
- data/lib/selenium/webdriver/{common/driver_extensions/has_network_connection.rb → ie/features.rb} +8 -11
- data/lib/selenium/webdriver/ie/options.rb +4 -3
- data/lib/selenium/webdriver/ie/service.rb +0 -22
- data/lib/selenium/webdriver/ie.rb +4 -3
- data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +0 -8
- data/lib/selenium/webdriver/remote/bridge.rb +13 -37
- data/lib/selenium/webdriver/remote/capabilities.rb +3 -53
- data/lib/selenium/webdriver/remote/driver.rb +35 -13
- data/lib/selenium/webdriver/remote/features.rb +75 -0
- data/lib/selenium/webdriver/remote/http/common.rb +3 -3
- data/lib/selenium/webdriver/remote/http/curb.rb +1 -3
- data/lib/selenium/webdriver/remote/http/default.rb +2 -2
- data/lib/selenium/webdriver/remote/response.rb +0 -1
- data/lib/selenium/webdriver/remote/server_error.rb +1 -1
- data/lib/selenium/webdriver/remote.rb +1 -1
- data/lib/selenium/webdriver/safari/driver.rb +7 -1
- data/lib/selenium/webdriver/safari/features.rb +5 -3
- data/lib/selenium/webdriver/safari/options.rb +5 -1
- data/lib/selenium/webdriver/safari/service.rb +10 -4
- data/lib/selenium/webdriver/safari.rb +1 -1
- data/lib/selenium/webdriver/support/color.rb +17 -17
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +2 -2
- data/lib/selenium/webdriver/support/guards/guard.rb +6 -5
- data/lib/selenium/webdriver/support/guards/guard_condition.rb +0 -2
- data/lib/selenium/webdriver/support/guards.rb +1 -1
- data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
- data/lib/selenium/webdriver/support/select.rb +2 -5
- data/lib/selenium/webdriver/version.rb +1 -1
- data/lib/selenium/webdriver.rb +5 -4
- data/selenium-webdriver.gemspec +10 -11
- metadata +43 -84
- data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
- data/lib/selenium/webdriver/support/cdp_client_generator.rb +0 -108
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7638be962a9b81fc47c44f342971675991879878eb23c46d7f8108e944adc054
|
4
|
+
data.tar.gz: 1b0cdd4f1d70fa58950549d92750d1d2836143418c42a868e7809e496f56726e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5247d707dc2b479973da7154b2bf96c9fefa9f134e56de8ed53fa596345c54a4c249debf357d6bcbc07eb000204bf1e8b4e031c02bb10bc110e346afbf0bf3af
|
7
|
+
data.tar.gz: af60275e2063f0ac2247b91bb148b45df2164b02893aeb7a2f21bda8def67d3c95ea620c58f04d5e8faa2561326afbe56903f23b4ff02686c80c84bda0b8746c
|
data/CHANGES
CHANGED
@@ -1,4 +1,222 @@
|
|
1
|
-
4.
|
1
|
+
4.16.0 (unreleased)
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Ruby:
|
5
|
+
* Add RBS files to Ruby (#12844)
|
6
|
+
* Convert binary locations for cygwin (#12618)
|
7
|
+
* Allow Selenium Manager to work with Unix (#13161)
|
8
|
+
* Extend RBS support for logger and log entry (#13192)
|
9
|
+
* Update rules_ruby to the latest version (#13235)
|
10
|
+
|
11
|
+
BiDi:
|
12
|
+
* Released selenium-devtools 0.120.0 (supports CDP v85, v118, v119, v120)
|
13
|
+
|
14
|
+
Chrome:
|
15
|
+
* Fix http proxy configuration for chrome (#13093)
|
16
|
+
|
17
|
+
Firefox:
|
18
|
+
* Delete 'lock' file in FF profile (#13090)
|
19
|
+
|
20
|
+
4.15.0 (2023-11-01)
|
21
|
+
=========================
|
22
|
+
|
23
|
+
* Do not set browser binary in selenium manager if it is an empty string (#12738)
|
24
|
+
* Add flaky condition to guards to mark unreliable tests
|
25
|
+
* Rake update needs to build latest grid for running remote tests
|
26
|
+
* Add CDP v119 and remove v116
|
27
|
+
* Implement file downloads (#12979)
|
28
|
+
|
29
|
+
4.14.0 (2023-10-09)
|
30
|
+
=========================
|
31
|
+
Ruby:
|
32
|
+
* allow users to access the full script of the atom directly
|
33
|
+
|
34
|
+
BiDi:
|
35
|
+
* Released selenium-devtools 0.118.0 (supports CDP v85, v116, v117, v118)
|
36
|
+
|
37
|
+
4.13.1 (2023-09-25)
|
38
|
+
=========================
|
39
|
+
Ruby:
|
40
|
+
* Fix bug preventing logging chromedriver to file
|
41
|
+
|
42
|
+
4.13.0 (2023-09-25)
|
43
|
+
=========================
|
44
|
+
Ruby:
|
45
|
+
* Fix bug preventing using performance logging with chromium
|
46
|
+
* Allow users to set Selenium Manager path by environment variable (#12752)
|
47
|
+
* Allow service to be started before the driver
|
48
|
+
* remove deprecated driver extensions for location and network connection
|
49
|
+
|
50
|
+
BiDi:
|
51
|
+
* Released selenium-devtools 0.117.0 (supports CDP v85, v115, v116, v117)
|
52
|
+
|
53
|
+
4.12.0 (2023-08-31)
|
54
|
+
=========================
|
55
|
+
Ruby:
|
56
|
+
* Fix bug preventing good error messages in Selenium Manager when stdout empty
|
57
|
+
* Fix bug with Firefox not loading net/http library by default (#12506)
|
58
|
+
* Remove support for using capabilities in local drivers
|
59
|
+
|
60
|
+
BiDi:
|
61
|
+
* Released selenium-devtools 0.116.0 (supports CDP v85, v114, v115, v116)
|
62
|
+
|
63
|
+
4.11.0 (2023-07-31)
|
64
|
+
=========================
|
65
|
+
Ruby:
|
66
|
+
* Made network interception threads fail silently (#12226)
|
67
|
+
* Have Selenium Manager binary locate drivers on PATH (#12345)
|
68
|
+
* Add browser output from selenium manager to options (#12398)
|
69
|
+
* Remove deprecated code (#12417)
|
70
|
+
BiDi:
|
71
|
+
* Released selenium-devtools 0.115.0 (supports CDP v85, v113, v114, v115)
|
72
|
+
Edge:
|
73
|
+
* Adding ignore process match for IE Mode across bindings (#12279)
|
74
|
+
|
75
|
+
4.10.0 (2023-06-07)
|
76
|
+
=========================
|
77
|
+
Ruby:
|
78
|
+
* Implement proxy support for Selenium Manager
|
79
|
+
* Prevent setting driver log level in Safari
|
80
|
+
* Change all Selenium Manager logging to :debug (#12145)
|
81
|
+
* Error messages include links to documentation
|
82
|
+
* Add custom error class for driver location and improve error logic
|
83
|
+
|
84
|
+
BiDi:
|
85
|
+
* Released selenium-devtools 0.114.0 (supports CDP v85, v112, v113, v114)
|
86
|
+
|
87
|
+
Edge:
|
88
|
+
* Add support for webview2
|
89
|
+
|
90
|
+
4.9.1 (2023-05-08)
|
91
|
+
=========================
|
92
|
+
Ruby:
|
93
|
+
* Allow users to specify driver process output in Service class (#11964)
|
94
|
+
* Updated minimum required Ruby version to 3.0
|
95
|
+
* Selenium Logger defaults to :info and all debugging is now logged as :debug (#11967)
|
96
|
+
* Every logging entry can be ignored based on ID, not just warnings
|
97
|
+
* Logging entries can be filtered to allow or ignore specific IDs
|
98
|
+
|
99
|
+
BiDi:
|
100
|
+
* Fix bug with loading devtools (#11931) (thanks Boris Petrov!)
|
101
|
+
* Released selenium-devtools 0.113.0 (supports CDP v85, v111, v112, v113)
|
102
|
+
|
103
|
+
4.9.0 (2023-04-21)
|
104
|
+
=========================
|
105
|
+
Ruby:
|
106
|
+
* Fix devtools version fallback (#11869)
|
107
|
+
* Fix bug in selenium manager escaping back slashes in Windows (#11884)
|
108
|
+
|
109
|
+
BiDi:
|
110
|
+
* Released selenium-devtools 0.112.0 (supports CDP v85, v110, v111, v112)
|
111
|
+
|
112
|
+
4.8.6 (2023-03-29)
|
113
|
+
=========================
|
114
|
+
Ruby:
|
115
|
+
* Properly escape arguments passed to Selenium Manager
|
116
|
+
|
117
|
+
4.8.5 (2023-03-28)
|
118
|
+
=========================
|
119
|
+
Ruby:
|
120
|
+
* Wrapping browser name in quotes when calling Selenium Manager
|
121
|
+
|
122
|
+
4.8.4 (2023-03-28)
|
123
|
+
=========================
|
124
|
+
Ruby:
|
125
|
+
* Update the selenium-manager versions to fix an IE naming issue (#11828)
|
126
|
+
|
127
|
+
4.8.3 (2023-03-26)
|
128
|
+
=========================
|
129
|
+
Ruby:
|
130
|
+
* Still need to use driver finder when using capabilities parameter
|
131
|
+
* Accommodate Driver Finder being sent something other than an Options instance
|
132
|
+
|
133
|
+
4.8.2 (2023-03-24)
|
134
|
+
=========================
|
135
|
+
Ruby:
|
136
|
+
* Ruby driver finder (#11523)
|
137
|
+
* Using json output with Selenium Manager
|
138
|
+
|
139
|
+
BiDi:
|
140
|
+
* Released selenium-devtools 0.111.0 (supports CDP v85, v109, v110, v111)
|
141
|
+
|
142
|
+
4.8.1 (2023-02-17)
|
143
|
+
=========================
|
144
|
+
Ruby:
|
145
|
+
* Fix autoload of WebDriver::Remote::Bridge::COMMANDS
|
146
|
+
* Subclass is setting value before the superclass is setting it to nil
|
147
|
+
* Updating Selenium Manager binaries for 4.8.1 release
|
148
|
+
|
149
|
+
BiDi:
|
150
|
+
* Released selenium-devtools 0.110.0 (supports CDP v85, v108, v109, v110)
|
151
|
+
* Close BiDi session on closing the last top-level browsing context
|
152
|
+
* Add filtering capability to LogInspector
|
153
|
+
|
154
|
+
4.8.0 (2023-01-23)
|
155
|
+
=========================
|
156
|
+
Ruby:
|
157
|
+
* Allow updating instance variables on service classes
|
158
|
+
* Deprecate extract_service_args processing in service classes
|
159
|
+
* Fix bug preventing sending nil to #send_keys with Remote Driver
|
160
|
+
* Fix bug with IE specific methods not available to IE Driver
|
161
|
+
* Created Chromium superclass for Chrome and Edge
|
162
|
+
* Deprecated platform and version setters/getters in Capabilities class
|
163
|
+
* Revamped driver constructor logic
|
164
|
+
* Fix bug preventing using Safari Technology Preview when using SafariOptions
|
165
|
+
* Fix bug preventing more than one driver type to access Selenium Manager
|
166
|
+
* Defaults to using Options instead of Capabilities
|
167
|
+
* Make Options classes more strict for allowed arguments and types
|
168
|
+
* Removed previously deprecated actions class parameters
|
169
|
+
* Removed Location struct
|
170
|
+
* Add comment with name of large JS executions (#11038)
|
171
|
+
* update logger with link on how to use it (#11478)
|
172
|
+
* Deprecate #add_option for Option classes in favor of constructor and attr_accessor
|
173
|
+
* Deprecate all unrecognized capabilities for Options classes
|
174
|
+
* Deprecate support for :capabilities for local drivers
|
175
|
+
* Deprecate browser class methods for Capabilities
|
176
|
+
* Deprecate #headless! for Chrome and Firefox
|
177
|
+
|
178
|
+
BiDi:
|
179
|
+
* Released selenium-devtools 0.109.0 (supports CDP v85, v107, v108, v109)
|
180
|
+
* Add LogInspector (#11368)
|
181
|
+
* Add Browsing context commands (#11446)
|
182
|
+
|
183
|
+
4.7.1 (2022-12-02)
|
184
|
+
=========================
|
185
|
+
Ruby:
|
186
|
+
* Fix bug preventing selenium manager from using Internet Explorer
|
187
|
+
|
188
|
+
4.7.0 (2022-12-01)
|
189
|
+
=========================
|
190
|
+
BiDi:
|
191
|
+
* Released selenium-devtools 0.108.0 (supports CDP v85, v106, v107, v108)
|
192
|
+
* Fix bug with socket stability
|
193
|
+
|
194
|
+
Ruby:
|
195
|
+
* Remove dependency on ChildProcess gem in favor of native Process.spawn (#11251)
|
196
|
+
* Add support for Selenium Manager to work with IE Driver
|
197
|
+
* Improve error handling for Selenium Manager
|
198
|
+
|
199
|
+
Safari:
|
200
|
+
* Fix bug preventing Safari Options from being used with Safari Technology Preview
|
201
|
+
|
202
|
+
4.6.1 (2022-11-04)
|
203
|
+
=========================
|
204
|
+
Ruby:
|
205
|
+
* fix bug preventing selenium-manager from being executable by default
|
206
|
+
|
207
|
+
4.6.0 (2022-11-04)
|
208
|
+
=========================
|
209
|
+
BiDi:
|
210
|
+
* Released selenium-devtools 0.107.0 (supports CDP v85, v105, v106, v107)
|
211
|
+
|
212
|
+
Ruby:
|
213
|
+
* firefox scroll by amount is only failing on mac
|
214
|
+
* add initial support for selenium manager
|
215
|
+
* Revert "[rb] do not allow Select class to work with disabled selects"
|
216
|
+
* Make sure selenium-manager is packed into gem
|
217
|
+
* Fix platform list in #scroll_by guard
|
218
|
+
|
219
|
+
4.5.0 (2022-09-28)
|
2
220
|
=========================
|
3
221
|
|
4
222
|
BiDi:
|
data/Gemfile
CHANGED
@@ -4,3 +4,6 @@ source 'https://rubygems.org'
|
|
4
4
|
Dir["#{__dir__}/*.gemspec"].each do |spec|
|
5
5
|
gemspec name: File.basename(spec, '.gemspec')
|
6
6
|
end
|
7
|
+
|
8
|
+
gem 'debug', '~> 1.7', require: false, platforms: %i[mri mingw x64_mingw]
|
9
|
+
gem 'steep', '~> 1.5.0', require: false, platforms: %i[mri mingw x64_mingw]
|
data/LICENSE
CHANGED
@@ -187,7 +187,7 @@
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
188
188
|
identification within third-party archives.
|
189
189
|
|
190
|
-
Copyright
|
190
|
+
Copyright 2023 Software Freedom Conservancy (SFC)
|
191
191
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
193
193
|
you may not use this file except in compliance with the License.
|
data/NOTICE
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
Copyright 2011-
|
1
|
+
Copyright 2011-2023 Software Freedom Conservancy
|
2
2
|
Copyright 2004-2011 Selenium committers
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# selenium-webdriver
|
2
2
|
|
3
|
-
This gem provides Ruby bindings for Selenium and supports MRI >=
|
3
|
+
This gem provides Ruby bindings for Selenium and supports MRI >= 3.0.
|
4
4
|
|
5
5
|
## Install
|
6
6
|
|
@@ -15,7 +15,7 @@ This gem provides Ruby bindings for Selenium and supports MRI >= 2.6
|
|
15
15
|
|
16
16
|
## License
|
17
17
|
|
18
|
-
Copyright 2009-
|
18
|
+
Copyright 2009-2023 Software Freedom Conservancy
|
19
19
|
|
20
20
|
Licensed to the Software Freedom Conservancy (SFC) under one
|
21
21
|
or more contributor license agreements. See the NOTICE file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/selenium/server.rb
CHANGED
@@ -17,7 +17,8 @@
|
|
17
17
|
# specific language governing permissions and limitations
|
18
18
|
# under the License.
|
19
19
|
|
20
|
-
require '
|
20
|
+
require 'selenium/webdriver/common/child_process'
|
21
|
+
require 'selenium/webdriver/common/port_prober'
|
21
22
|
require 'selenium/webdriver/common/socket_poller'
|
22
23
|
require 'net/http'
|
23
24
|
|
@@ -165,7 +166,7 @@ module Selenium
|
|
165
166
|
# :standalone, #hub, #node
|
166
167
|
#
|
167
168
|
|
168
|
-
attr_accessor :role, :port, :timeout, :background, :log
|
169
|
+
attr_accessor :role, :host, :port, :timeout, :background, :log
|
169
170
|
|
170
171
|
#
|
171
172
|
# @param [String] jar Path to the server jar.
|
@@ -185,7 +186,7 @@ module Selenium
|
|
185
186
|
@jar = jar
|
186
187
|
@host = '127.0.0.1'
|
187
188
|
@role = opts.fetch(:role, 'standalone')
|
188
|
-
@port = opts.fetch(:port, 4444)
|
189
|
+
@port = opts.fetch(:port, WebDriver::PortProber.above(4444))
|
189
190
|
@timeout = opts.fetch(:timeout, 30)
|
190
191
|
@background = opts.fetch(:background, false)
|
191
192
|
@additional_args = opts.fetch(:args, [])
|
@@ -207,11 +208,6 @@ module Selenium
|
|
207
208
|
end
|
208
209
|
|
209
210
|
def stop
|
210
|
-
begin
|
211
|
-
Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
|
212
|
-
rescue Errno::ECONNREFUSED
|
213
|
-
end
|
214
|
-
|
215
211
|
stop_process if @process
|
216
212
|
poll_for_shutdown
|
217
213
|
|
@@ -233,13 +229,7 @@ module Selenium
|
|
233
229
|
private
|
234
230
|
|
235
231
|
def stop_process
|
236
|
-
|
237
|
-
|
238
|
-
begin
|
239
|
-
@process.poll_for_exit(5)
|
240
|
-
rescue ChildProcess::TimeoutError
|
241
|
-
@process.stop
|
242
|
-
end
|
232
|
+
@process.stop
|
243
233
|
rescue Errno::ECHILD
|
244
234
|
# already dead
|
245
235
|
ensure
|
@@ -252,16 +242,12 @@ module Selenium
|
|
252
242
|
properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
|
253
243
|
args = ['-jar', @jar, @role, '--port', @port.to_s]
|
254
244
|
server_command = ['java'] + properties + args + @additional_args
|
255
|
-
cp = ChildProcess.build(*server_command)
|
256
|
-
WebDriver.logger.debug("Executing Process #{server_command}")
|
257
|
-
|
258
|
-
io = cp.io
|
245
|
+
cp = WebDriver::ChildProcess.build(*server_command)
|
259
246
|
|
260
247
|
if @log.is_a?(String)
|
261
|
-
|
262
|
-
io.stdout = io.stderr = @log_file
|
248
|
+
cp.io = @log
|
263
249
|
elsif @log
|
264
|
-
io
|
250
|
+
cp.io = :out
|
265
251
|
end
|
266
252
|
|
267
253
|
cp.detach = @background
|
@@ -97,7 +97,8 @@ Number(d[1]),c=Number(d[2]),d=Number(d[3]),0<=b&&255>=b&&0<=c&&255>=c&&0<=d&&255
|
|
97
97
|
function $c(a,b){var c=a.currentStyle||a.style,d=c[b];void 0===d&&ea(c.getPropertyValue)&&(d=c.getPropertyValue(b));return"inherit"!=d?void 0!==d?d:null:(a=Zc(a))?$c(a,b):null}
|
98
98
|
function ad(a,b,c){function d(g){var h=W(g);return 0<h.height&&0<h.width?!0:S(g,"PATH")&&(0<h.height||0<h.width)?(g=V(g,"stroke-width"),!!g&&0<parseInt(g,10)):"hidden"!=V(g,"overflow")&&sa(g.childNodes,function(n){return 3==n.nodeType||S(n)&&d(n)})}function e(g){return bd(g)==X&&ta(g.childNodes,function(h){return!S(h)||e(h)||!d(h)})}if(!S(a))throw Error("Argument to isShown must be of type Element");if(S(a,"BODY"))return!0;if(S(a,"OPTION")||S(a,"OPTGROUP"))return a=lb(a,function(g){return S(g,"SELECT")}),
|
99
99
|
!!a&&ad(a,!0,c);var f=cd(a);if(f)return!!f.image&&0<f.rect.width&&0<f.rect.height&&ad(f.image,b,c);if(S(a,"INPUT")&&"hidden"==a.type.toLowerCase()||S(a,"NOSCRIPT"))return!1;f=V(a,"visibility");return"collapse"!=f&&"hidden"!=f&&c(a)&&(b||0!=dd(a))&&d(a)?!e(a):!1}
|
100
|
-
function ed(a){function b(c){if(S(c)&&"none"==V(c,"display"))return!1;var d;if((d=c.parentNode)&&d.shadowRoot&&void 0!==c.assignedSlot)d=c.assignedSlot?c.assignedSlot.parentNode:null;else if(c.getDestinationInsertionPoints){var e=c.getDestinationInsertionPoints();0<e.length&&(d=e[e.length-1])}if(Yc&&d instanceof ShadowRoot){if(d.host.shadowRoot!==d)return!1;d=d.host}return!d||9!=d.nodeType&&11!=d.nodeType?d&&S(d,"DETAILS")&&!d.open&&!S(c,"SUMMARY")?!1:!!d&&b(d):!0}return ad(a,!1,
|
100
|
+
function ed(a){function b(c){if(S(c)&&"none"==V(c,"display"))return!1;var d;if((d=c.parentNode)&&d.shadowRoot&&void 0!==c.assignedSlot)d=c.assignedSlot?c.assignedSlot.parentNode:null;else if(c.getDestinationInsertionPoints){var e=c.getDestinationInsertionPoints();0<e.length&&(d=e[e.length-1])}if(Yc&&d instanceof ShadowRoot){if(d.host.shadowRoot&&d.host.shadowRoot!==d)return!1;d=d.host}return!d||9!=d.nodeType&&11!=d.nodeType?d&&S(d,"DETAILS")&&!d.open&&!S(c,"SUMMARY")?!1:!!d&&b(d):!0}return ad(a,!1,
|
101
|
+
b)}var X="hidden";
|
101
102
|
function bd(a){function b(m){function v(Ab){if(Ab==g)return!0;var pc=V(Ab,"display");return 0==pc.lastIndexOf("inline",0)||"contents"==pc||"absolute"==qc&&"static"==V(Ab,"position")?!1:!0}var qc=V(m,"position");if("fixed"==qc)return u=!0,m==g?null:g;for(m=Zc(m);m&&!v(m);)m=Zc(m);return m}function c(m){var v=m;if("visible"==n)if(m==g&&h)v=h;else if(m==h)return{x:"visible",y:"visible"};v={x:V(v,"overflow-x"),y:V(v,"overflow-y")};m==g&&(v.x="visible"==v.x?"auto":v.x,v.y="visible"==v.y?"auto":v.y);return v}
|
102
103
|
function d(m){if(m==g){var v=(new fb(f)).a;m=v.scrollingElement?v.scrollingElement:Oa||"CSS1Compat"!=v.compatMode?v.body||v.documentElement:v.documentElement;v=v.parentWindow||v.defaultView;m=t&&Ua("10")&&v.pageYOffset!=m.scrollTop?new cb(m.scrollLeft,m.scrollTop):new cb(v.pageXOffset||m.scrollLeft,v.pageYOffset||m.scrollTop)}else m=new cb(m.scrollLeft,m.scrollTop);return m}var e=fd(a),f=A(a),g=f.documentElement,h=f.body,n=V(g,"overflow"),u;for(a=b(a);a;a=b(a)){var p=c(a);if("visible"!=p.x||"visible"!=
|
103
104
|
p.y){var G=W(a);if(0==G.width||0==G.height)return X;var R=e.a<G.a,fa=e.b<G.b;if(R&&"hidden"==p.x||fa&&"hidden"==p.y)return X;if(R&&"visible"!=p.x||fa&&"visible"!=p.y){R=d(a);fa=e.b<G.b-R.y;if(e.a<G.a-R.x&&"visible"!=p.x||fa&&"visible"!=p.x)return X;e=bd(a);return e==X?X:"scroll"}R=e.f>=G.a+G.width;G=e.c>=G.b+G.height;if(R&&"hidden"==p.x||G&&"hidden"==p.y)return X;if(R&&"visible"!=p.x||G&&"visible"!=p.y){if(u&&(p=d(a),e.f>=g.scrollWidth-p.x||e.a>=g.scrollHeight-p.y))return X;e=bd(a);return e==X?X:
|
@@ -113,10 +114,9 @@ function nd(a,b,c,d){a=a.nodeValue.replace(/[\u200b\u200e\u200f]/g,"");a=a.repla
|
|
113
114
|
function pd(a,b,c,d,e){if(3==a.nodeType&&c)nd(a,b,d,e);else if(S(a))if(S(a,"CONTENT")||S(a,"SLOT")){for(var f=a;f.parentNode;)f=f.parentNode;f instanceof ShadowRoot?(a=S(a,"CONTENT")?a.getDistributedNodes():a.assignedNodes(),l(a,function(g){pd(g,b,c,d,e)})):jd(a,b)}else if(S(a,"SHADOW")){for(f=a;f.parentNode;)f=f.parentNode;if(f instanceof ShadowRoot&&(a=f))for(a=a.olderShadowRoot;a;)l(a.childNodes,function(g){pd(g,b,c,d,e)}),a=a.olderShadowRoot}else jd(a,b)}
|
114
115
|
function jd(a,b){a.shadowRoot&&l(a.shadowRoot.childNodes,function(c){pd(c,b,!0,null,null)});ld(a,b,function(c,d,e,f,g){var h=null;1==c.nodeType?h=c:3==c.nodeType&&(h=c);null!=h&&(null!=h.assignedSlot||h.getDestinationInsertionPoints&&0<h.getDestinationInsertionPoints().length)||pd(c,d,e,f,g)})};var qd={C:function(a,b){return!(!a.querySelectorAll||!a.querySelector)&&!/^\d.*/.test(b)},o:function(a,b){var c=eb(b),d="string"===typeof a?c.a.getElementById(a):a;return d?Uc(d,"id")==a&&b!=d&&hb(b,d)?d:ua(mb(c,"*"),function(e){return Uc(e,"id")==a&&b!=e&&hb(b,e)}):null},j:function(a,b){if(!a)return[];if(qd.C(b,a))try{return b.querySelectorAll("#"+qd.T(a))}catch(c){return[]}b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"id")==a})},T:function(a){return a.replace(/([\s'"\\#.:;,!?+<>=~*^$|%&@`{}\-\/\[\]\(\)])/g,
|
115
116
|
"\\$1")}};var Y={},rd={};Y.N=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return ua(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.K=function(a,b,c){try{var d=Nc.j("a",b)}catch(e){d=mb(eb(b),"A",null,b)}return pa(d,function(e){e=id(e);e=e.replace(/^[\s]+|[\s]+$/g,"");return c&&-1!=e.indexOf(a)||e==a})};Y.o=function(a,b){return Y.N(a,b,!1)};Y.j=function(a,b){return Y.K(a,b,!1)};rd.o=function(a,b){return Y.N(a,b,!0)};
|
116
|
-
rd.j=function(a,b){return Y.K(a,b,!0)};var Z={F:function(a,b){return function(c){var d=Z.u(a);d=W(d);c=W(c);return b.call(null,d,c)}},R:function(a){return Z.F(a,function(b,c){return c.b+c.height<b.b})},S:function(a){return Z.F(a,function(b,c){return b.b+b.height<c.b})},V:function(a){return Z.F(a,function(b,c){return c.a+c.width<b.a})},aa:function(a){return Z.F(a,function(b,c){return b.a+b.width<c.a})},W:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=
|
117
|
-
|
118
|
-
|
119
|
-
Z.U=function(a,b){var c=[];l(a,function(e){e&&ta(b,function(f){var g=f.kind,h=Z.P[g];if(!h)throw new P(61,"Cannot find filter suitable for "+g);return h.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=Z.O[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?Z.ba(a,c):c:c};
|
117
|
+
rd.j=function(a,b){return Y.K(a,b,!0)};var Z={F:function(a,b){return function(c){var d=Z.u(a);d=W(d);c=W(c);return b.call(null,d,c)}},R:function(a){return Z.F(a,function(b,c){return c.b+c.height<b.b})},S:function(a){return Z.F(a,function(b,c){return b.b+b.height<c.b})},V:function(a){return Z.F(a,function(b,c){return c.a+c.width<b.a})},aa:function(a){return Z.F(a,function(b,c){return b.a+b.width<c.a})},W:function(a,b){var c;b?c=b:"number"==typeof a.distance&&(c=a.distance);c||(c=50);return function(d){var e=Z.u(a);if(e===d)return!1;e=W(e);
|
118
|
+
d=W(d);e=new U(e.a-c,e.b-c,e.width+2*c,e.height+2*c);return e.a<=d.a+d.width&&d.a<=e.a+e.width&&e.b<=d.b+d.height&&d.b<=e.b+e.height}},u:function(a){if(ha(a)&&1==a.nodeType)return a;if(ea(a))return Z.u(a.call(null));if(ha(a)){var b;a:{if(b=sd(a)){var c=td[b];if(c&&ea(c.o)){b=c.o(a[b],Bc.document);break a}}throw new P(61,"Unsupported locator strategy: "+b);}if(!b)throw new P(7,"No element has been found by "+JSON.stringify(a));return b}throw new P(61,"Selector is of wrong type: "+JSON.stringify(a));
|
119
|
+
}};Z.P={left:Z.V,right:Z.aa,above:Z.R,below:Z.S,near:Z.W};Z.O={left:Z.u,right:Z.u,above:Z.u,below:Z.u,near:Z.u};Z.U=function(a,b){var c=[];l(a,function(e){e&&ta(b,function(f){var g=f.kind,h=Z.P[g];if(!h)throw new P(61,"Cannot find filter suitable for "+g);return h.apply(null,f.args)(e)},null)&&c.push(e)},null);a=b[b.length-1];var d=Z.O[a?a.kind:"unknown"];return d?(a=d.apply(null,a.args))?Z.ba(a,c):c:c};
|
120
120
|
Z.ba=function(a,b){function c(f){f=W(f);return Math.sqrt(Math.pow(d-(f.a+Math.max(1,f.width)/2),2)+Math.pow(e-(f.b+Math.max(1,f.height)/2),2))}a=W(a);var d=a.a+Math.max(1,a.width)/2,e=a.b+Math.max(1,a.height)/2;xa(b,function(f,g){return c(f)-c(g)});return b};Z.o=function(a,b){a=Z.j(a,b);return 0==a.length?null:a[0]};
|
121
121
|
Z.j=function(a,b){if(!a.hasOwnProperty("root")||!a.hasOwnProperty("filters"))throw new P(61,"Locator not suitable for relative locators: "+JSON.stringify(a));var c=a.filters,d=da(c);if("array"!=d&&("object"!=d||"number"!=typeof c.length))throw new P(61,"Targets should be an array: "+JSON.stringify(a));var e;S(a.root)?e=[a.root]:e=ud(a.root,b);return 0==e.length?[]:Z.U(e,a.filters)};var vd={o:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)[0]||null},j:function(a,b){if(""===a)throw new P(32,'Unable to locate an element with the tagName ""');return b.getElementsByTagName(a)}};var td={className:Dc,"class name":Dc,css:Nc,"css selector":Nc,relative:Z,id:qd,linkText:Y,"link text":Y,name:{o:function(a,b){b=mb(eb(b),"*",null,b);return ua(b,function(c){return Uc(c,"name")==a})},j:function(a,b){b=mb(eb(b),"*",null,b);return pa(b,function(c){return Uc(c,"name")==a})}},partialLinkText:rd,"partial link text":rd,tagName:vd,"tag name":vd,xpath:T};function sd(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null}
|
122
122
|
function ud(a,b){var c=sd(a);if(c){var d=td[c];if(d&&ea(d.j))return d.j(a[c],b||Bc.document)}throw new P(61,"Unsupported locator strategy: "+c);};ca("_",ud);; return this._.apply(null,arguments);}).apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}
|
File without changes
|
@@ -97,4 +97,5 @@ r.y){var D=Jc(a);if(0==D.width||0==D.height)return Z;var L=e.a<D.a,M=e.b<D.b;if(
|
|
97
97
|
function Jc(a){var b=Lc(a);if(b)return b.rect;if(W(a,"HTML"))return a=A(a),a=((a?a.parentWindow||a.defaultView:window)||window).document,a="CSS1Compat"==a.compatMode?a.documentElement:a.body,a=new Va(a.clientWidth,a.clientHeight),new X(0,0,a.width,a.height);try{var c=a.getBoundingClientRect()}catch(d){return new X(0,0,0,0)}b=new X(c.left,c.top,c.right-c.left,c.bottom-c.top);v&&a.ownerDocument.body&&(a=A(a),b.a-=a.documentElement.clientLeft+a.body.clientLeft,b.b-=a.documentElement.clientTop+a.body.clientTop);
|
98
98
|
return b}function Lc(a){var b=W(a,"MAP");if(!b&&!W(a,"AREA"))return null;var c=b?a:W(a.parentNode,"MAP")?a.parentNode:null,d=null,e=null;c&&c.name&&(d=Dc('/descendant::*[@usemap = "#'+c.name+'"]',A(c)))&&(e=Jc(d),b||"default"==a.shape.toLowerCase()||(a=Oc(a),b=Math.min(Math.max(a.a,0),e.width),c=Math.min(Math.max(a.b,0),e.height),e=new X(b+e.a,c+e.b,Math.min(a.width,e.width-b),Math.min(a.height,e.height-c))));return{image:d,rect:e||new X(0,0,0,0)}}
|
99
99
|
function Oc(a){var b=a.shape.toLowerCase();a=a.coords.split(",");if("rect"==b&&4==a.length){b=a[0];var c=a[1];return new X(b,c,a[2]-b,a[3]-c)}if("circle"==b&&3==a.length)return b=a[2],new X(a[0]-b,a[1]-b,2*b,2*b);if("poly"==b&&2<a.length){b=a[0];c=a[1];for(var d=b,e=c,f=2;f+1<a.length;f+=2)b=Math.min(b,a[f]),d=Math.max(d,a[f]),c=Math.min(c,a[f+1]),e=Math.max(e,a[f+1]);return new X(b,c,d-b,e-c)}return new X(0,0,0,0)}function Nc(a){a=Jc(a);return new Ec(a.b,a.a+a.width,a.b+a.height,a.a)}
|
100
|
-
function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a
|
100
|
+
function Mc(a){if(Ac){if("relative"==Y(a,"position"))return 1;a=Y(a,"filter");return(a=a.match(/^alpha\(opacity=(\d*)\)/)||a.match(/^progid:DXImageTransform.Microsoft.Alpha\(Opacity=(\d*)\)/))?Number(a[1])/100:1}return Pc(a)}function Pc(a){var b=1,c=Y(a,"opacity");c&&(b=Number(c));(a=Gc(a))&&(b*=Pc(a));return b};ba("_",function(a,b){function c(d){if(W(d)&&"none"==Y(d,"display"))return!1;var e;if((e=d.parentNode)&&e.shadowRoot&&void 0!==d.assignedSlot)e=d.assignedSlot?d.assignedSlot.parentNode:null;else if(d.getDestinationInsertionPoints){var f=d.getDestinationInsertionPoints();0<f.length&&(e=f[f.length-1])}if(Fc&&e instanceof ShadowRoot){if(e.host.shadowRoot&&e.host.shadowRoot!==e)return!1;e=e.host}return!e||9!=e.nodeType&&11!=e.nodeType?e&&W(e,"DETAILS")&&!e.open&&!W(d,"SUMMARY")?!1:!!e&&c(e):!0}return Ic(a,
|
101
|
+
!!b,c)});; return this._.apply(null,arguments);}).apply({navigator:typeof window!='undefined'?window.navigator:null,document:typeof window!='undefined'?window.document:null}, arguments);}
|
File without changes
|
@@ -20,6 +20,10 @@
|
|
20
20
|
module Selenium
|
21
21
|
module WebDriver
|
22
22
|
module Atoms
|
23
|
+
def atom_script(function_name)
|
24
|
+
format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
|
25
|
+
atom: read_atom(function_name))
|
26
|
+
end
|
23
27
|
|
24
28
|
private
|
25
29
|
|
@@ -28,10 +32,8 @@ module Selenium
|
|
28
32
|
end
|
29
33
|
|
30
34
|
def execute_atom(function_name, *arguments)
|
31
|
-
|
32
|
-
execute_script(script, *arguments)
|
35
|
+
execute_script(atom_script(function_name), *arguments)
|
33
36
|
end
|
34
|
-
|
35
37
|
end # Atoms
|
36
38
|
end # WebDriver
|
37
39
|
end # Selenium
|
@@ -0,0 +1,88 @@
|
|
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_relative 'navigate_result'
|
21
|
+
require_relative 'browsing_context_info'
|
22
|
+
|
23
|
+
module Selenium
|
24
|
+
module WebDriver
|
25
|
+
class BiDi
|
26
|
+
class BrowsingContext
|
27
|
+
attr_accessor :id
|
28
|
+
|
29
|
+
READINESS_STATE = {
|
30
|
+
none: 'none',
|
31
|
+
interactive: 'interactive',
|
32
|
+
complete: 'complete'
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
def initialize(driver:, browsing_context_id: nil, type: nil, reference_context: nil)
|
36
|
+
unless driver.capabilities.web_socket_url
|
37
|
+
raise Error::WebDriverError,
|
38
|
+
'WebDriver instance must support BiDi protocol'
|
39
|
+
end
|
40
|
+
|
41
|
+
unless type.nil? || %i[window tab].include?(type)
|
42
|
+
raise ArgumentError,
|
43
|
+
"Valid types are :window & :tab. Received: #{type.inspect}"
|
44
|
+
end
|
45
|
+
|
46
|
+
@bidi = driver.bidi
|
47
|
+
@id = browsing_context_id.nil? ? create(type, reference_context)['context'] : browsing_context_id
|
48
|
+
end
|
49
|
+
|
50
|
+
def navigate(url:, readiness_state: nil)
|
51
|
+
unless readiness_state.nil? || READINESS_STATE.key?(readiness_state)
|
52
|
+
raise ArgumentError,
|
53
|
+
"Valid readiness states are :none, :interactive & :complete. Received: #{readiness_state.inspect}"
|
54
|
+
end
|
55
|
+
|
56
|
+
navigate_result = @bidi.send_cmd('browsingContext.navigate', context: @id, url: url,
|
57
|
+
wait: READINESS_STATE[readiness_state])
|
58
|
+
|
59
|
+
NavigateResult.new(
|
60
|
+
url: navigate_result['url'],
|
61
|
+
navigation_id: navigate_result['navigation']
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_tree(max_depth: nil)
|
66
|
+
result = @bidi.send_cmd('browsingContext.getTree', root: @id, maxDepth: max_depth).dig('contexts', 0)
|
67
|
+
|
68
|
+
BrowsingContextInfo.new(
|
69
|
+
id: result['context'],
|
70
|
+
url: result['url'],
|
71
|
+
children: result['children'],
|
72
|
+
parent_context: result['parent']
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
def close
|
77
|
+
@bidi.send_cmd('browsingContext.close', context: @id)
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def create(type, reference_context)
|
83
|
+
@bidi.send_cmd('browsingContext.create', type: type.to_s, referenceContext: reference_context)
|
84
|
+
end
|
85
|
+
end # BrowsingContext
|
86
|
+
end # BiDi
|
87
|
+
end # WebDriver
|
88
|
+
end # Selenium
|
@@ -0,0 +1,35 @@
|
|
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
|
+
class BiDi
|
23
|
+
class BrowsingContextInfo
|
24
|
+
attr_accessor :id, :url, :children, :parent_browsing_context
|
25
|
+
|
26
|
+
def initialize(id:, url:, children:, parent_context:)
|
27
|
+
@id = id
|
28
|
+
@url = url
|
29
|
+
@children = children
|
30
|
+
@parent_browsing_context = parent_context
|
31
|
+
end
|
32
|
+
end # BrowsingContextInfo
|
33
|
+
end # BiDi
|
34
|
+
end # WebDriver
|
35
|
+
end # Selenium
|
@@ -0,0 +1,35 @@
|
|
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
|
+
class BiDi
|
23
|
+
class BaseLogEntry
|
24
|
+
attr_accessor :level, :text, :timestamp, :stack_trace
|
25
|
+
|
26
|
+
def initialize(level:, text:, timestamp:, stack_trace:)
|
27
|
+
@level = level
|
28
|
+
@text = text
|
29
|
+
@timestamp = timestamp
|
30
|
+
@stack_trace = stack_trace
|
31
|
+
end
|
32
|
+
end # BaseLogEntry
|
33
|
+
end # BiDi
|
34
|
+
end # WebDriver
|
35
|
+
end # Selenium
|
@@ -0,0 +1,35 @@
|
|
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
|
+
class BiDi
|
23
|
+
class ConsoleLogEntry < GenericLogEntry
|
24
|
+
attr_accessor :method, :realm, :args
|
25
|
+
|
26
|
+
def initialize(method:, realm:, args:, **opts)
|
27
|
+
super(**opts)
|
28
|
+
@method = method
|
29
|
+
@realm = realm
|
30
|
+
@args = args
|
31
|
+
end
|
32
|
+
end # ConsoleLogEntry
|
33
|
+
end # BiDi
|
34
|
+
end # WebDriver
|
35
|
+
end # Selenium
|