selenium-webdriver 4.1.0 → 4.9.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 (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +221 -1
  3. data/LICENSE +1 -1
  4. data/NOTICE +1 -1
  5. data/bin/linux/selenium-manager +0 -0
  6. data/bin/macos/selenium-manager +0 -0
  7. data/bin/windows/selenium-manager.exe +0 -0
  8. data/lib/selenium/server.rb +35 -26
  9. data/lib/selenium/webdriver/atoms/findElements.js +0 -0
  10. data/lib/selenium/webdriver/atoms/getAttribute.js +0 -0
  11. data/lib/selenium/webdriver/atoms/isDisplayed.js +0 -0
  12. data/lib/selenium/webdriver/atoms/mutationListener.js +0 -0
  13. data/lib/selenium/webdriver/atoms.rb +2 -3
  14. data/lib/selenium/webdriver/bidi/browsing_context.rb +88 -0
  15. data/lib/selenium/webdriver/bidi/browsing_context_info.rb +35 -0
  16. data/lib/selenium/webdriver/bidi/log/base_log_entry.rb +35 -0
  17. data/lib/selenium/webdriver/bidi/log/console_log_entry.rb +35 -0
  18. data/lib/selenium/webdriver/bidi/log/filter_by.rb +40 -0
  19. data/lib/selenium/webdriver/bidi/log/generic_log_entry.rb +33 -0
  20. data/lib/selenium/webdriver/bidi/log/javascript_log_entry.rb +33 -0
  21. data/lib/selenium/webdriver/bidi/log_inspector.rb +143 -0
  22. data/lib/selenium/webdriver/bidi/navigate_result.rb +33 -0
  23. data/lib/selenium/webdriver/bidi/session.rb +51 -0
  24. data/lib/selenium/webdriver/bidi.rb +56 -0
  25. data/lib/selenium/webdriver/chrome/driver.rb +9 -29
  26. data/lib/selenium/webdriver/chrome/features.rb +6 -68
  27. data/lib/selenium/webdriver/chrome/options.rb +3 -223
  28. data/lib/selenium/webdriver/chrome/profile.rb +3 -83
  29. data/lib/selenium/webdriver/chrome/service.rb +3 -23
  30. data/lib/selenium/webdriver/chrome.rb +0 -14
  31. data/lib/selenium/webdriver/chromium/driver.rb +61 -0
  32. data/lib/selenium/webdriver/chromium/features.rb +103 -0
  33. data/lib/selenium/webdriver/chromium/options.rb +261 -0
  34. data/lib/selenium/webdriver/chromium/profile.rb +113 -0
  35. data/lib/selenium/webdriver/chromium/service.rb +42 -0
  36. data/lib/selenium/webdriver/chromium.rb +32 -0
  37. data/lib/selenium/webdriver/common/action_builder.rb +72 -22
  38. data/lib/selenium/webdriver/common/child_process.rb +124 -0
  39. data/lib/selenium/webdriver/common/driver.rb +36 -74
  40. data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +0 -2
  41. data/lib/selenium/webdriver/common/driver_extensions/full_page_screenshot.rb +0 -1
  42. data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +0 -2
  43. data/lib/selenium/webdriver/common/driver_extensions/has_apple_permissions.rb +0 -2
  44. data/lib/selenium/webdriver/common/driver_extensions/has_authentication.rb +0 -2
  45. data/lib/selenium/webdriver/common/driver_extensions/{has_remote_status.rb → has_bidi.rb} +10 -5
  46. data/lib/selenium/webdriver/common/driver_extensions/has_casting.rb +10 -1
  47. data/lib/selenium/webdriver/common/driver_extensions/has_cdp.rb +0 -2
  48. data/lib/selenium/webdriver/common/driver_extensions/has_context.rb +1 -4
  49. data/lib/selenium/webdriver/common/driver_extensions/has_debugger.rb +0 -2
  50. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +0 -2
  51. data/lib/selenium/webdriver/common/driver_extensions/has_launching.rb +0 -2
  52. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +1 -2
  53. data/lib/selenium/webdriver/common/driver_extensions/has_log_events.rb +1 -2
  54. data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +0 -2
  55. data/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb +2 -69
  56. data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +0 -2
  57. data/lib/selenium/webdriver/common/driver_extensions/has_pinned_scripts.rb +1 -3
  58. data/lib/selenium/webdriver/common/driver_finder.rb +43 -0
  59. data/lib/selenium/webdriver/common/element.rb +8 -8
  60. data/lib/selenium/webdriver/common/error.rb +1 -3
  61. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +2 -2
  62. data/lib/selenium/webdriver/common/interactions/input_device.rb +10 -4
  63. data/lib/selenium/webdriver/common/interactions/interaction.rb +12 -25
  64. data/lib/selenium/webdriver/common/interactions/interactions.rb +24 -4
  65. data/lib/selenium/webdriver/common/interactions/key_actions.rb +5 -1
  66. data/lib/selenium/webdriver/common/interactions/key_input.rb +11 -27
  67. data/lib/selenium/webdriver/common/interactions/none_input.rb +10 -8
  68. data/lib/selenium/webdriver/common/interactions/pause.rb +49 -0
  69. data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +59 -70
  70. data/lib/selenium/webdriver/common/interactions/pointer_cancel.rb +45 -0
  71. data/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb +63 -0
  72. data/lib/selenium/webdriver/common/interactions/pointer_input.rb +15 -84
  73. data/lib/selenium/webdriver/common/interactions/pointer_move.rb +60 -0
  74. data/lib/selenium/webdriver/common/interactions/pointer_press.rb +85 -0
  75. data/lib/selenium/webdriver/common/interactions/scroll.rb +59 -0
  76. data/lib/selenium/webdriver/common/interactions/scroll_origin.rb +48 -0
  77. data/lib/selenium/webdriver/common/interactions/typing_interaction.rb +54 -0
  78. data/lib/selenium/webdriver/common/interactions/wheel_actions.rb +113 -0
  79. data/lib/selenium/webdriver/common/interactions/wheel_input.rb +42 -0
  80. data/lib/selenium/webdriver/common/keys.rb +1 -0
  81. data/lib/selenium/webdriver/common/local_driver.rb +55 -0
  82. data/lib/selenium/webdriver/common/logger.rb +10 -2
  83. data/lib/selenium/webdriver/common/manager.rb +0 -27
  84. data/lib/selenium/webdriver/common/options.rb +32 -17
  85. data/lib/selenium/webdriver/common/platform.rb +8 -5
  86. data/lib/selenium/webdriver/common/profile_helper.rb +1 -1
  87. data/lib/selenium/webdriver/common/proxy.rb +1 -1
  88. data/lib/selenium/webdriver/common/search_context.rb +0 -6
  89. data/lib/selenium/webdriver/common/selenium_manager.rb +108 -0
  90. data/lib/selenium/webdriver/common/service.rb +11 -22
  91. data/lib/selenium/webdriver/common/service_manager.rb +5 -14
  92. data/lib/selenium/webdriver/common/shadow_root.rb +2 -3
  93. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  94. data/lib/selenium/webdriver/common/socket_poller.rb +1 -1
  95. data/lib/selenium/webdriver/common/takes_screenshot.rb +2 -3
  96. data/lib/selenium/webdriver/common/target_locator.rb +2 -3
  97. data/lib/selenium/webdriver/common/timeouts.rb +2 -2
  98. data/lib/selenium/webdriver/common/virtual_authenticator/credential.rb +85 -0
  99. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator.rb +72 -0
  100. data/lib/selenium/webdriver/common/virtual_authenticator/virtual_authenticator_options.rb +62 -0
  101. data/lib/selenium/webdriver/common/websocket_connection.rb +164 -0
  102. data/lib/selenium/webdriver/common/window.rb +6 -6
  103. data/lib/selenium/webdriver/common/zipper.rb +1 -1
  104. data/lib/selenium/webdriver/common.rb +21 -3
  105. data/lib/selenium/webdriver/devtools/console_event.rb +0 -2
  106. data/lib/selenium/webdriver/devtools/exception_event.rb +0 -2
  107. data/lib/selenium/webdriver/devtools/mutation_event.rb +0 -2
  108. data/lib/selenium/webdriver/devtools/network_interceptor.rb +173 -0
  109. data/lib/selenium/webdriver/devtools/pinned_script.rb +0 -2
  110. data/lib/selenium/webdriver/devtools/request.rb +1 -3
  111. data/lib/selenium/webdriver/devtools/response.rb +1 -3
  112. data/lib/selenium/webdriver/devtools.rb +17 -114
  113. data/lib/selenium/webdriver/edge/driver.rb +9 -3
  114. data/lib/selenium/webdriver/edge/features.rb +4 -4
  115. data/lib/selenium/webdriver/edge/options.rb +3 -5
  116. data/lib/selenium/webdriver/edge/profile.rb +2 -2
  117. data/lib/selenium/webdriver/edge/service.rb +2 -6
  118. data/lib/selenium/webdriver/firefox/driver.rb +9 -2
  119. data/lib/selenium/webdriver/firefox/features.rb +6 -6
  120. data/lib/selenium/webdriver/firefox/options.rb +9 -3
  121. data/lib/selenium/webdriver/firefox/profile.rb +7 -11
  122. data/lib/selenium/webdriver/firefox/service.rb +0 -6
  123. data/lib/selenium/webdriver/firefox/util.rb +46 -0
  124. data/lib/selenium/webdriver/firefox.rb +1 -14
  125. data/lib/selenium/webdriver/ie/driver.rb +7 -1
  126. data/lib/selenium/webdriver/ie/service.rb +1 -7
  127. data/lib/selenium/webdriver/ie.rb +0 -14
  128. data/lib/selenium/webdriver/remote/{commands.rb → bridge/commands.rb} +15 -8
  129. data/lib/selenium/webdriver/remote/bridge.rb +59 -30
  130. data/lib/selenium/webdriver/remote/capabilities.rb +34 -12
  131. data/lib/selenium/webdriver/remote/driver.rb +19 -14
  132. data/lib/selenium/webdriver/remote/http/curb.rb +0 -2
  133. data/lib/selenium/webdriver/remote/http/default.rb +7 -12
  134. data/lib/selenium/webdriver/remote/response.rb +2 -3
  135. data/lib/selenium/webdriver/remote.rb +0 -1
  136. data/lib/selenium/webdriver/safari/driver.rb +7 -1
  137. data/lib/selenium/webdriver/safari/features.rb +0 -2
  138. data/lib/selenium/webdriver/safari/options.rb +5 -1
  139. data/lib/selenium/webdriver/safari/service.rb +0 -4
  140. data/lib/selenium/webdriver/safari.rb +1 -15
  141. data/lib/selenium/webdriver/support/color.rb +20 -20
  142. data/lib/selenium/webdriver/support/guards/guard.rb +0 -2
  143. data/lib/selenium/webdriver/support/guards/guard_condition.rb +1 -3
  144. data/lib/selenium/webdriver/support/guards.rb +1 -1
  145. data/lib/selenium/webdriver/support/relative_locator.rb +0 -1
  146. data/lib/selenium/webdriver/support/select.rb +3 -1
  147. data/lib/selenium/webdriver/version.rb +1 -1
  148. data/lib/selenium/webdriver.rb +4 -4
  149. data/selenium-webdriver.gemspec +13 -11
  150. metadata +70 -59
  151. data/lib/selenium/webdriver/remote/http/persistent.rb +0 -65
  152. data/lib/selenium/webdriver/support/cdp/domain.rb.erb +0 -63
  153. 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: 40e4bef1fdee7ae817c56466ec231be400d677d56a8c8f46b797c6b3eba28de9
4
- data.tar.gz: a9c1af31f12db6096f06c2a89e487e40ea2bb53b8f6e46e5f77a3046f149bb34
3
+ metadata.gz: f1ae360596be57c29db02808a7dae16c36062801e7639e83b366a54cdba5e3b2
4
+ data.tar.gz: f31169f7cfec055abb7a2f3595eee8e453acf316651a829af5f254a0f824cf9e
5
5
  SHA512:
6
- metadata.gz: b5325d0fe9f5fdb721ed4a6daa1384d7876dc7a072dd52f46c73d76b1614434c123fff2b4a9d7de01538968eddfbad57f2e1a87f4dce0e560a850dcf21988840
7
- data.tar.gz: 3b345ac66d051c32267d1c4ef9b2dd70aea36e2c4e5bb35ce30197d748effca8fed460824d1961ad5a39340358fc9be3f200708a38557e5e878b09be1b0d61c0
6
+ metadata.gz: 675dad14a433939c81dabbb0276b1c5a97d95f0b1451ca48aa0e908c2cc0658f1d90e3970be4e3f62e65ff5eaef5cf391b5d646f50413ca46ea2f24de821fb5a
7
+ data.tar.gz: dd9d26b855e7b1f01f667d113181f6e7b35367ee74459b693a3c5872cc92a9e58f9d2d849de3aaff9738e3e77cb3f3117617219b4f76e2fda2f66bc75279ee8d
data/CHANGES CHANGED
@@ -1,4 +1,224 @@
1
- 4.1.0 (2021-11-18)
1
+ 4.9.0 (2023-04-21)
2
+ =========================
3
+ Ruby:
4
+ * Fix devtools version fallback (#11869)
5
+ * Fix bug in selenium manager escaping back slashes in Windows (#11884)
6
+
7
+ BiDi:
8
+ * Released selenium-devtools 0.112.0 (supports CDP v85, v110, v111, v112)
9
+
10
+ 4.8.6 (2023-03-29)
11
+ =========================
12
+ Ruby:
13
+ * Properly escape arguments passed to Selenium Manager
14
+
15
+ 4.8.5 (2023-03-28)
16
+ =========================
17
+ Ruby:
18
+ * Wrapping browser name in quotes when calling Selenium Manager
19
+
20
+ 4.8.4 (2023-03-28)
21
+ =========================
22
+ Ruby:
23
+ * Update the selenium-manager versions to fix an IE naming issue (#11828)
24
+
25
+ 4.8.3 (2023-03-26)
26
+ =========================
27
+ Ruby:
28
+ * Still need to use driver finder when using capabilities parameter
29
+ * Accommodate Driver Finder being sent something other than an Options instance
30
+
31
+ 4.8.2 (2023-03-24)
32
+ =========================
33
+ Ruby:
34
+ * Ruby driver finder (#11523)
35
+ * Using json output with Selenium Manager
36
+
37
+ BiDi:
38
+ * Released selenium-devtools 0.111.0 (supports CDP v85, v109, v110, v111)
39
+
40
+ 4.8.1 (2023-02-17)
41
+ =========================
42
+ Ruby:
43
+ * Fix autoload of WebDriver::Remote::Bridge::COMMANDS
44
+ * Subclass is setting value before the superclass is setting it to nil
45
+ * Updating Selenium Manager binaries for 4.8.1 release
46
+
47
+ BiDi:
48
+ * Released selenium-devtools 0.110.0 (supports CDP v85, v108, v109, v110)
49
+ * Close BiDi session on closing the last top-level browsing context
50
+ * Add filtering capability to LogInspector
51
+
52
+ 4.8.0 (2023-01-23)
53
+ =========================
54
+ Ruby:
55
+ * Allow updating instance variables on service classes
56
+ * Deprecate extract_service_args processing in service classes
57
+ * Fix bug preventing sending nil to #send_keys with Remote Driver
58
+ * Fix bug with IE specific methods not available to IE Driver
59
+ * Created Chromium superclass for Chrome and Edge
60
+ * Deprecated platform and version setters/getters in Capabilities class
61
+ * Revamped driver constructor logic
62
+ * Fix bug preventing using Safari Technology Preview when using SafariOptions
63
+ * Fix bug preventing more than one driver type to access Selenium Manager
64
+ * Defaults to using Options instead of Capabilities
65
+ * Make Options classes more strict for allowed arguments and types
66
+ * Removed previously deprecated actions class parameters
67
+ * Removed Location struct
68
+ * Add comment with name of large JS executions (#11038)
69
+ * update logger with link on how to use it (#11478)
70
+ * Deprecate #add_option for Option classes in favor of constructor and attr_accessor
71
+ * Deprecate all unrecognized capabilities for Options classes
72
+ * Deprecate support for :capabilities for local drivers
73
+ * Deprecate browser class methods for Capabilities
74
+ * Deprecate #headless! for Chrome and Firefox
75
+
76
+ BiDi:
77
+ * Released selenium-devtools 0.109.0 (supports CDP v85, v107, v108, v109)
78
+ * Add LogInspector (#11368)
79
+ * Add Browsing context commands (#11446)
80
+
81
+ 4.7.1 (2022-12-02)
82
+ =========================
83
+ Ruby:
84
+ * Fix bug preventing selenium manager from using Internet Explorer
85
+
86
+ 4.7.0 (2022-12-01)
87
+ =========================
88
+ BiDi:
89
+ * Released selenium-devtools 0.108.0 (supports CDP v85, v106, v107, v108)
90
+ * Fix bug with socket stability
91
+
92
+ Ruby:
93
+ * Remove dependency on ChildProcess gem in favor of native Process.spawn (#11251)
94
+ * Add support for Selenium Manager to work with IE Driver
95
+ * Improve error handling for Selenium Manager
96
+
97
+ Safari:
98
+ * Fix bug preventing Safari Options from being used with Safari Technology Preview
99
+
100
+ 4.6.1 (2022-11-04)
101
+ =========================
102
+ Ruby:
103
+ * fix bug preventing selenium-manager from being executable by default
104
+
105
+ 4.6.0 (2022-11-04)
106
+ =========================
107
+ BiDi:
108
+ * Released selenium-devtools 0.107.0 (supports CDP v85, v105, v106, v107)
109
+
110
+ Ruby:
111
+ * firefox scroll by amount is only failing on mac
112
+ * add initial support for selenium manager
113
+ * Revert "[rb] do not allow Select class to work with disabled selects"
114
+ * Make sure selenium-manager is packed into gem
115
+ * Fix platform list in #scroll_by guard
116
+
117
+ 4.5.0 (2022-09-28)
118
+ =========================
119
+
120
+ BiDi:
121
+ * Released selenium-devtools 0.105.0 (supports CDP v85, v103, v104, v105)
122
+ * Released selenium-devtools 0.106.0 (supports CDP v85, v104, v105, v106)
123
+ * Add HasBiDi support to Chrome
124
+
125
+ Ruby:
126
+ * Fix bug in Platform code
127
+ * Update Select class to error when elements are disabled (#10812)
128
+
129
+ Firefox:
130
+ * Add support for installing unsigned add-ons (#10265, thanks TamsilAmani!)
131
+ * Change accept_insecure_certificates to true by default (to match other bindings)
132
+ * Set debugger_address option to true by default
133
+
134
+ Server:
135
+ * Add support for initializing server class with arguments and log level
136
+
137
+ 4.4.0 (2022-08-09)
138
+ =========================
139
+
140
+ BiDi:
141
+ * Released selenium-devtools 0.103.1 to fix websocket dependency requirement
142
+ * Released selenium-devtools 0.104.0 (supports CDP v85, v102, v103, v104)
143
+ * Have network interceptor ignore cancelled requests (#10856)
144
+ * Improve websocket message handling
145
+
146
+ Chromium:
147
+ * Prevent users from setting w3c: false and warn for true (thanks Tamsil Amani!)
148
+
149
+ Ruby:
150
+ * Implement Virtual Authenticator (#10903, #10541) (thanks Tamsil Amani!)
151
+
152
+ 4.3.0 (2022-06-23)
153
+ =========================
154
+
155
+ BiDi:
156
+ * Released selenium-devtools 0.103.0 (supports CDP v85, v101, v102, v103)
157
+
158
+ Ruby:
159
+ * Allow specifying which button is clicked in pointer action class methods
160
+ * Remove deprecated `Persistent` http class
161
+ * Remove deprecated HasRemoteStatus module
162
+ * Remove deprecated `Manager#new_window` and `Manager#logs`
163
+ * `ActionBuilder#move_to` no longer attempts to move to top left corner of element
164
+ * Remove deprecated support for sending Service parameters directly to Driver constructor
165
+ * Remove deprecated setters and getters for driver path on Browser modules
166
+ * Remove deprecated support for passing in options argument to Options class
167
+ * Allow `:options` parameter to take `Options` instance argument like other languages
168
+ * Remove deprecated support for `:desired_capabilities` & `:options` with `Hash` argument
169
+
170
+ 4.2.1 (2022-05-31)
171
+ =========================
172
+
173
+ Ruby
174
+ * Fix bug in setting default duration in Actions constructor
175
+
176
+ 4.2.0 (2022-05-27)
177
+ =========================
178
+
179
+ BiDi:
180
+ * Released selenium-devtools 0.97.0 (supports CDP v85, v95, v96, v97)
181
+ * Released selenium-devtools 0.98.0 (supports CDP v85, v96, v97, v98)
182
+ * Released selenium-devtools 0.99.0 (supports CDP v85, v97, v98, v99)
183
+ * Released selenium-devtools 0.100.0 (supports CDP v85, v98, v99, v100)
184
+ * Released selenium-devtools 0.101.0 (supports CDP v85, v99, v100, v101)
185
+ * Released selenium-devtools 0.102.0 (supports CDP v85, v100, v101, v102)
186
+ * Implement simple BiDi connection
187
+ * Fix bug in initial BiDi implementation (thanks Boris Petrov!)
188
+ * Fix bug with mutating headers in request interception (#10574)
189
+ * Fix bug with empty response headers (thanks Viren Negi!)
190
+
191
+ Firefox:
192
+ * Add support to Firefox Options for environment capability
193
+ * Use addon parameter instead of path parameter to avoid using file detector
194
+ * Restore #from_name method to Firefox profile (#10146)
195
+
196
+ Chromium:
197
+ * Add support for casting desktop
198
+
199
+ Ruby:
200
+ * Updated minimum required Ruby version to 2.7
201
+ * Fix bug by not attempting to stop service process when it's not started (#10015)
202
+ * Fix bug to not stop service process when it's not started (thanks Atsushi Tatsuma!)
203
+ * Use driver endpoint to get page source instead of JavaScript
204
+ * Add zenkaku_hankaku key support
205
+ * Fix download support of Selenium Server
206
+ * Do not convert Tag Name to CSS Selector
207
+
208
+ ActionBuilder:
209
+ * Raise error if input device not found
210
+ * Move `TypingInteraction` from `Interactions::KeyInput` to `Interactions` module
211
+ * Throw better errors for `PointerInput` methods
212
+ * Allow each action interaction class to validate its own source
213
+ * Set all Interactions classes to private
214
+ * Allow device names to use a default id if one is not specified
215
+ * Deprecate default mouse and keyboard values in constructor, favoring devices parameter
216
+ * Add support for pointer event properties
217
+ * Implement scroll wheel support
218
+ * Deprecate ordered pair parameters for pause method in favor of keywords
219
+ * Deprecate move to element with offset changing origin to top left of element
220
+
221
+ 4.1.0 (2021-11-22)
2
222
  =========================
3
223
 
4
224
  DevTools:
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 2021 Software Freedom Conservancy (SFC)
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-2021 Software Freedom Conservancy
1
+ Copyright 2011-2023 Software Freedom Conservancy
2
2
  Copyright 2004-2011 Selenium committers
Binary file
Binary file
Binary file
@@ -17,7 +17,7 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- require 'childprocess'
20
+ require 'selenium/webdriver/common/child_process'
21
21
  require 'selenium/webdriver/common/socket_poller'
22
22
  require 'net/http'
23
23
 
@@ -84,15 +84,15 @@ module Selenium
84
84
  return download_file_name if File.exist? download_file_name
85
85
 
86
86
  begin
87
- server = 'https://github.com/seleniumhq/selenium/releases/download'
88
- released = Net::HTTP.get_response(URI.parse("#{server}/selenium-#{required_version}/#{download_file_name}"))
87
+ download_location = available_assets[download_file_name]['browser_download_url']
88
+ released = Net::HTTP.get_response(URI.parse(download_location))
89
89
  redirected = URI.parse released.header['location']
90
90
 
91
91
  File.open(download_file_name, 'wb') do |destination|
92
92
  download_server(redirected, destination)
93
93
  end
94
94
  rescue StandardError
95
- FileUtils.rm download_file_name if File.exist? download_file_name
95
+ FileUtils.rm_rf download_file_name
96
96
  raise
97
97
  end
98
98
 
@@ -105,19 +105,24 @@ module Selenium
105
105
 
106
106
  def latest
107
107
  @latest ||= begin
108
- net_http_start('api.github.com') do |http|
109
- json = http.get('/repos/seleniumhq/selenium/releases').body
110
- all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
111
- server_assets = all_assets.map { |asset| asset['name'][/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }.compact
112
- server_assets.map { |version| Gem::Version.new(version) }.max.version
113
- end
108
+ available = available_assets.keys.map { |key| key[/selenium-server-(\d+\.\d+\.\d+)\.jar/, 1] }
109
+ available.map { |asset| Gem::Version.new(asset) }.max.to_s
114
110
  end
115
111
  end
116
112
 
117
113
  # @api private
118
114
 
115
+ def available_assets
116
+ @available_assets ||= net_http_start('api.github.com') do |http|
117
+ json = http.get('/repos/seleniumhq/selenium/releases').body
118
+ all_assets = JSON.parse(json).map { |release| release['assets'] }.flatten
119
+ server_assets = all_assets.select { |asset| asset['name'].match(/selenium-server-(\d+\.\d+\.\d+)\.jar/) }
120
+ server_assets.each_with_object({}) { |asset, hash| hash[asset.delete('name')] = asset }
121
+ end
122
+ end
123
+
119
124
  def net_http_start(address, &block)
120
- http_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
125
+ http_proxy = ENV.fetch('http_proxy', nil) || ENV.fetch('HTTP_PROXY', nil)
121
126
  if http_proxy
122
127
  http_proxy = "http://#{http_proxy}" unless http_proxy.start_with?('http://')
123
128
  uri = URI.parse(http_proxy)
@@ -177,15 +182,21 @@ module Selenium
177
182
  def initialize(jar, opts = {})
178
183
  raise Errno::ENOENT, jar unless File.exist?(jar)
179
184
 
180
- @jar = jar
181
- @host = '127.0.0.1'
182
- @role = opts.fetch(:role, 'standalone')
183
- @port = opts.fetch(:port, 4444)
184
- @timeout = opts.fetch(:timeout, 30)
185
+ @jar = jar
186
+ @host = '127.0.0.1'
187
+ @role = opts.fetch(:role, 'standalone')
188
+ @port = opts.fetch(:port, 4444)
189
+ @timeout = opts.fetch(:timeout, 30)
185
190
  @background = opts.fetch(:background, false)
186
- @log = opts[:log]
187
- @log_file = nil
188
- @additional_args = []
191
+ @additional_args = opts.fetch(:args, [])
192
+ @log = opts[:log]
193
+ if opts[:log_level]
194
+ @log ||= true
195
+ @additional_args << '--log-level'
196
+ @additional_args << opts[:log_level].to_s
197
+ end
198
+
199
+ @log_file = nil
189
200
  end
190
201
 
191
202
  def start
@@ -199,6 +210,7 @@ module Selenium
199
210
  begin
200
211
  Net::HTTP.get(@host, '/selenium-server/driver/?cmd=shutDownSeleniumServer', @port)
201
212
  rescue Errno::ECONNREFUSED
213
+ nil
202
214
  end
203
215
 
204
216
  stop_process if @process
@@ -226,7 +238,7 @@ module Selenium
226
238
 
227
239
  begin
228
240
  @process.poll_for_exit(5)
229
- rescue ChildProcess::TimeoutError
241
+ rescue WebDriver::ChildProcess::TimeoutError
230
242
  @process.stop
231
243
  end
232
244
  rescue Errno::ECHILD
@@ -241,16 +253,13 @@ module Selenium
241
253
  properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
242
254
  args = ['-jar', @jar, @role, '--port', @port.to_s]
243
255
  server_command = ['java'] + properties + args + @additional_args
244
- cp = ChildProcess.build(*server_command)
256
+ cp = WebDriver::ChildProcess.build(*server_command)
245
257
  WebDriver.logger.debug("Executing Process #{server_command}")
246
258
 
247
- io = cp.io
248
-
249
259
  if @log.is_a?(String)
250
- @log_file = File.open(@log, 'w')
251
- io.stdout = io.stderr = @log_file
260
+ cp.io = @log
252
261
  elsif @log
253
- io.inherit!
262
+ cp.io = :out
254
263
  end
255
264
 
256
265
  cp.detach = @background
File without changes
File without changes
File without changes
File without changes
@@ -20,7 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Atoms
23
-
24
23
  private
25
24
 
26
25
  def read_atom(function)
@@ -28,10 +27,10 @@ module Selenium
28
27
  end
29
28
 
30
29
  def execute_atom(function_name, *arguments)
31
- script = format("return (%<atom>s).apply(null, arguments)", atom: read_atom(function_name))
30
+ script = format("/* #{function_name} */return (%<atom>s).apply(null, arguments)",
31
+ atom: read_atom(function_name))
32
32
  execute_script(script, *arguments)
33
33
  end
34
-
35
34
  end # Atoms
36
35
  end # WebDriver
37
36
  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
@@ -0,0 +1,40 @@
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 FilterBy
24
+ attr_accessor :level
25
+
26
+ def initialize(level)
27
+ @level = level
28
+ end
29
+
30
+ def self.log_level(level = nil)
31
+ unless %w[debug error info warning].include?(level)
32
+ raise Error::WebDriverError,
33
+ "Valid log levels are 'debug', 'error', 'info' and 'warning'. Received: #{level}"
34
+ end
35
+ FilterBy.new(level)
36
+ end
37
+ end # FilterBy
38
+ end # BiDi
39
+ end # WebDriver
40
+ end # Selenium