selenium-webdriver 4.0.0.alpha5 → 4.0.0.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +38 -0
  3. data/LICENSE +1 -1
  4. data/lib/selenium/webdriver/atoms/findElements.js +1 -1
  5. data/lib/selenium/webdriver/chrome/bridge.rb +4 -6
  6. data/lib/selenium/webdriver/chrome/driver.rb +4 -0
  7. data/lib/selenium/webdriver/chrome/options.rb +24 -19
  8. data/lib/selenium/webdriver/common.rb +1 -0
  9. data/lib/selenium/webdriver/common/driver.rb +55 -23
  10. data/lib/selenium/webdriver/common/logger.rb +1 -1
  11. data/lib/selenium/webdriver/common/manager.rb +5 -0
  12. data/lib/selenium/webdriver/common/options.rb +32 -9
  13. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  14. data/lib/selenium/webdriver/common/service.rb +12 -106
  15. data/lib/selenium/webdriver/common/service_manager.rb +151 -0
  16. data/lib/selenium/webdriver/devtools.rb +118 -0
  17. data/lib/selenium/webdriver/devtools/accessibility.rb +62 -0
  18. data/lib/selenium/webdriver/devtools/animation.rb +98 -0
  19. data/lib/selenium/webdriver/devtools/application_cache.rb +64 -0
  20. data/lib/selenium/webdriver/devtools/audits.rb +61 -0
  21. data/lib/selenium/webdriver/devtools/background_service.rb +67 -0
  22. data/lib/selenium/webdriver/devtools/browser.rb +123 -0
  23. data/lib/selenium/webdriver/devtools/cache_storage.rb +73 -0
  24. data/lib/selenium/webdriver/devtools/cast.rb +70 -0
  25. data/lib/selenium/webdriver/devtools/console.rb +57 -0
  26. data/lib/selenium/webdriver/devtools/css.rb +165 -0
  27. data/lib/selenium/webdriver/devtools/database.rb +64 -0
  28. data/lib/selenium/webdriver/devtools/debugger.rb +229 -0
  29. data/lib/selenium/webdriver/devtools/device_orientation.rb +53 -0
  30. data/lib/selenium/webdriver/devtools/dom.rb +320 -0
  31. data/lib/selenium/webdriver/devtools/domdebugger.rb +93 -0
  32. data/lib/selenium/webdriver/devtools/domsnapshot.rb +65 -0
  33. data/lib/selenium/webdriver/devtools/domstorage.rb +79 -0
  34. data/lib/selenium/webdriver/devtools/emulation.rb +180 -0
  35. data/lib/selenium/webdriver/devtools/fetch.rb +97 -0
  36. data/lib/selenium/webdriver/devtools/headless_experimental.rb +61 -0
  37. data/lib/selenium/webdriver/devtools/heap_profiler.rb +107 -0
  38. data/lib/selenium/webdriver/devtools/indexed_db.rb +100 -0
  39. data/lib/selenium/webdriver/devtools/input.rb +140 -0
  40. data/lib/selenium/webdriver/devtools/inspector.rb +55 -0
  41. data/lib/selenium/webdriver/devtools/io.rb +59 -0
  42. data/lib/selenium/webdriver/devtools/layer_tree.rb +95 -0
  43. data/lib/selenium/webdriver/devtools/log.rb +66 -0
  44. data/lib/selenium/webdriver/devtools/media.rb +57 -0
  45. data/lib/selenium/webdriver/devtools/memory.rb +86 -0
  46. data/lib/selenium/webdriver/devtools/network.rb +228 -0
  47. data/lib/selenium/webdriver/devtools/overlay.rb +157 -0
  48. data/lib/selenium/webdriver/devtools/page.rb +374 -0
  49. data/lib/selenium/webdriver/devtools/performance.rb +63 -0
  50. data/lib/selenium/webdriver/devtools/profiler.rb +111 -0
  51. data/lib/selenium/webdriver/devtools/runtime.rb +193 -0
  52. data/lib/selenium/webdriver/devtools/schema.rb +46 -0
  53. data/lib/selenium/webdriver/devtools/security.rb +71 -0
  54. data/lib/selenium/webdriver/devtools/service_worker.rb +116 -0
  55. data/lib/selenium/webdriver/devtools/storage.rb +95 -0
  56. data/lib/selenium/webdriver/devtools/system_info.rb +50 -0
  57. data/lib/selenium/webdriver/devtools/target.rb +141 -0
  58. data/lib/selenium/webdriver/devtools/tethering.rb +55 -0
  59. data/lib/selenium/webdriver/devtools/tracing.rb +76 -0
  60. data/lib/selenium/webdriver/devtools/web_audio.rb +70 -0
  61. data/lib/selenium/webdriver/devtools/web_authn.rb +94 -0
  62. data/lib/selenium/webdriver/edge_chrome/bridge.rb +9 -2
  63. data/lib/selenium/webdriver/edge_chrome/driver.rb +4 -0
  64. data/lib/selenium/webdriver/edge_chrome/options.rb +2 -0
  65. data/lib/selenium/webdriver/edge_html/options.rb +2 -9
  66. data/lib/selenium/webdriver/firefox/bridge.rb +1 -1
  67. data/lib/selenium/webdriver/firefox/driver.rb +4 -0
  68. data/lib/selenium/webdriver/firefox/options.rb +5 -10
  69. data/lib/selenium/webdriver/ie/options.rb +7 -10
  70. data/lib/selenium/webdriver/remote/bridge.rb +3 -13
  71. data/lib/selenium/webdriver/remote/capabilities.rb +11 -6
  72. data/lib/selenium/webdriver/safari/bridge.rb +1 -1
  73. data/lib/selenium/webdriver/safari/driver.rb +4 -0
  74. data/lib/selenium/webdriver/safari/options.rb +1 -8
  75. data/lib/selenium/webdriver/support/cdp_client_generator.rb +77 -0
  76. data/lib/selenium/webdriver/support/color.rb +2 -2
  77. data/lib/selenium/webdriver/version.rb +1 -1
  78. data/selenium-webdriver.gemspec +2 -2
  79. metadata +53 -5
@@ -146,12 +146,7 @@ module Selenium
146
146
  caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
147
147
  caps.page_load_strategy = data.delete('pageLoadStrategy') if data.key?('pageLoadStrategy')
148
148
 
149
- if data.key?('timeouts')
150
- timeouts = data.delete('timeouts')
151
- caps.implicit_timeout = timeouts['implicit'] if timeouts
152
- caps.page_load_timeout = timeouts['pageLoad'] if timeouts
153
- caps.script_timeout = timeouts['script'] if timeouts
154
- end
149
+ process_timeouts(caps, data.delete('timeouts'))
155
150
 
156
151
  if data.key?('proxy')
157
152
  proxy = data.delete('proxy')
@@ -166,6 +161,16 @@ module Selenium
166
161
 
167
162
  caps
168
163
  end
164
+
165
+ private
166
+
167
+ def process_timeouts(caps, timeouts)
168
+ return if timeouts.nil?
169
+
170
+ caps.implicit_timeout = timeouts['implicit']
171
+ caps.page_load_timeout = timeouts['pageLoad']
172
+ caps.script_timeout = timeouts['script']
173
+ end
169
174
  end
170
175
 
171
176
  #
@@ -20,7 +20,7 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Safari
23
- module Bridge
23
+ class Bridge < WebDriver::Remote::Bridge
24
24
 
25
25
  # https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/WebDriverEndpointDoc/Commands/Commands.html
26
26
  COMMANDS = {
@@ -35,6 +35,10 @@ module Selenium
35
35
  def browser
36
36
  :safari
37
37
  end
38
+
39
+ def bridge_class
40
+ Bridge
41
+ end
38
42
  end # Driver
39
43
  end # Safari
40
44
  end # WebDriver
@@ -26,6 +26,7 @@ module Selenium
26
26
  # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
27
27
  CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',
28
28
  automatic_profiling: 'safari:automaticProfiling'}.freeze
29
+ BROWSER = 'safari'
29
30
 
30
31
  CAPABILITIES.each_key do |key|
31
32
  define_method key do
@@ -52,14 +53,6 @@ module Selenium
52
53
  def initialize(**opts)
53
54
  super
54
55
  end
55
-
56
- #
57
- # @api private
58
- #
59
-
60
- def as_json(*)
61
- generate_as_json(super)
62
- end
63
56
  end # Options
64
57
  end # Safari
65
58
  end # WebDriver
@@ -0,0 +1,77 @@
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 'erb'
21
+ require 'json'
22
+
23
+ module Selenium
24
+ module WebDriver
25
+ module Support
26
+ class CDPClientGenerator
27
+ DEVTOOLS_DIR = File.expand_path('../devtools', __dir__)
28
+ BROWSER_PROTOCOL_PATH = File.expand_path('cdp/browser_protocol.json', __dir__)
29
+ JS_PROTOCOL_PATH = File.expand_path('cdp/js_protocol.json', __dir__)
30
+ TEMPLATE_PATH = File.expand_path('cdp/domain.rb.erb', __dir__)
31
+
32
+ RESERVED_KEYWORDS = %w[end].freeze
33
+
34
+ def initialize
35
+ @browser_protocol = JSON.parse(File.read(BROWSER_PROTOCOL_PATH), symbolize_names: true)
36
+ @js_protocol = JSON.parse(File.read(JS_PROTOCOL_PATH), symbolize_names: true)
37
+ @template = ERB.new(File.read(TEMPLATE_PATH))
38
+ end
39
+
40
+ def call
41
+ @browser_protocol[:domains].each(&method(:process_domain))
42
+ @js_protocol[:domains].each(&method(:process_domain))
43
+ end
44
+
45
+ def process_domain(domain)
46
+ result = @template.result_with_hash(domain: domain, h: self)
47
+ filename = File.join(DEVTOOLS_DIR, "#{snake_case(domain[:domain])}.rb")
48
+ File.write(filename, remove_empty_lines(result))
49
+ end
50
+
51
+ def snake_case(string)
52
+ name = string.gsub(/([a-z])([A-Z])/, '\1_\2').downcase
53
+ # Certain CDP parameters conflict with Ruby keywords
54
+ # so we prefix the name with underscore.
55
+ name = "_#{name}" if RESERVED_KEYWORDS.include?(name)
56
+
57
+ name
58
+ end
59
+
60
+ def kwargs(parameters)
61
+ parameters = parameters.map do |parameter|
62
+ if parameter[:optional]
63
+ "#{snake_case(parameter[:name])}: nil"
64
+ else
65
+ "#{snake_case(parameter[:name])}:"
66
+ end
67
+ end
68
+ parameters.join(', ')
69
+ end
70
+
71
+ def remove_empty_lines(string)
72
+ string.split("\n").reject { |l| l =~ /^\s+$/ }.join("\n")
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -72,7 +72,7 @@ module Selenium
72
72
  end
73
73
  end
74
74
 
75
- def self.from_hsl(h, s, l, a) # rubocop:disable Naming/UncommunicativeMethodParamName
75
+ def self.from_hsl(h, s, l, a) # rubocop:disable Naming/MethodParameterName
76
76
  h = Float(h) / 360
77
77
  s = Float(s) / 100
78
78
  l = Float(l) / 100
@@ -138,7 +138,7 @@ module Selenium
138
138
  end
139
139
 
140
140
  def hex
141
- format '#%02x%02x%02x', red, green, blue
141
+ format '#%<red>02x%<green>02x%<blue>02x', red: red, green: green, blue: blue
142
142
  end
143
143
  end # Color
144
144
  end # Support
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.0.0.alpha5'
22
+ VERSION = '4.0.0.alpha6'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  }
27
27
 
28
28
  s.required_rubygems_version = Gem::Requirement.new('> 1.3.1') if s.respond_to? :required_rubygems_version=
29
- s.required_ruby_version = Gem::Requirement.new('>= 2.4')
29
+ s.required_ruby_version = Gem::Requirement.new('>= 2.5')
30
30
 
31
31
  s.files = Dir[root + '/**/*'].reject { |e| e =~ /ruby\.iml|build\.desc/ }.map { |e| e.sub(root + '/', '') }
32
32
  s.require_paths = ['lib']
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
  s.add_development_dependency 'rack', ['~> 2.0']
41
41
  s.add_development_dependency 'rake'
42
42
  s.add_development_dependency 'rspec', ['~> 3.0']
43
- s.add_development_dependency 'rubocop', ['~> 0.73.0']
43
+ s.add_development_dependency 'rubocop', ['~> 0.84.0']
44
44
  s.add_development_dependency 'rubocop-performance'
45
45
  s.add_development_dependency 'rubocop-rspec'
46
46
  s.add_development_dependency 'webmock', ['~> 3.5']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha5
4
+ version: 4.0.0.alpha6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-18 00:00:00.000000000 Z
13
+ date: 2020-05-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +121,7 @@ dependencies:
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.73.0
124
+ version: 0.84.0
125
125
  name: rubocop
126
126
  prerelease: false
127
127
  type: :development
@@ -129,7 +129,7 @@ dependencies:
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: 0.73.0
132
+ version: 0.84.0
133
133
  - !ruby/object:Gem::Dependency
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
@@ -259,6 +259,7 @@ files:
259
259
  - lib/selenium/webdriver/common/proxy.rb
260
260
  - lib/selenium/webdriver/common/search_context.rb
261
261
  - lib/selenium/webdriver/common/service.rb
262
+ - lib/selenium/webdriver/common/service_manager.rb
262
263
  - lib/selenium/webdriver/common/socket_lock.rb
263
264
  - lib/selenium/webdriver/common/socket_poller.rb
264
265
  - lib/selenium/webdriver/common/target_locator.rb
@@ -266,6 +267,52 @@ files:
266
267
  - lib/selenium/webdriver/common/wait.rb
267
268
  - lib/selenium/webdriver/common/window.rb
268
269
  - lib/selenium/webdriver/common/zipper.rb
270
+ - lib/selenium/webdriver/devtools.rb
271
+ - lib/selenium/webdriver/devtools/accessibility.rb
272
+ - lib/selenium/webdriver/devtools/animation.rb
273
+ - lib/selenium/webdriver/devtools/application_cache.rb
274
+ - lib/selenium/webdriver/devtools/audits.rb
275
+ - lib/selenium/webdriver/devtools/background_service.rb
276
+ - lib/selenium/webdriver/devtools/browser.rb
277
+ - lib/selenium/webdriver/devtools/cache_storage.rb
278
+ - lib/selenium/webdriver/devtools/cast.rb
279
+ - lib/selenium/webdriver/devtools/console.rb
280
+ - lib/selenium/webdriver/devtools/css.rb
281
+ - lib/selenium/webdriver/devtools/database.rb
282
+ - lib/selenium/webdriver/devtools/debugger.rb
283
+ - lib/selenium/webdriver/devtools/device_orientation.rb
284
+ - lib/selenium/webdriver/devtools/dom.rb
285
+ - lib/selenium/webdriver/devtools/domdebugger.rb
286
+ - lib/selenium/webdriver/devtools/domsnapshot.rb
287
+ - lib/selenium/webdriver/devtools/domstorage.rb
288
+ - lib/selenium/webdriver/devtools/emulation.rb
289
+ - lib/selenium/webdriver/devtools/fetch.rb
290
+ - lib/selenium/webdriver/devtools/headless_experimental.rb
291
+ - lib/selenium/webdriver/devtools/heap_profiler.rb
292
+ - lib/selenium/webdriver/devtools/indexed_db.rb
293
+ - lib/selenium/webdriver/devtools/input.rb
294
+ - lib/selenium/webdriver/devtools/inspector.rb
295
+ - lib/selenium/webdriver/devtools/io.rb
296
+ - lib/selenium/webdriver/devtools/layer_tree.rb
297
+ - lib/selenium/webdriver/devtools/log.rb
298
+ - lib/selenium/webdriver/devtools/media.rb
299
+ - lib/selenium/webdriver/devtools/memory.rb
300
+ - lib/selenium/webdriver/devtools/network.rb
301
+ - lib/selenium/webdriver/devtools/overlay.rb
302
+ - lib/selenium/webdriver/devtools/page.rb
303
+ - lib/selenium/webdriver/devtools/performance.rb
304
+ - lib/selenium/webdriver/devtools/profiler.rb
305
+ - lib/selenium/webdriver/devtools/runtime.rb
306
+ - lib/selenium/webdriver/devtools/schema.rb
307
+ - lib/selenium/webdriver/devtools/security.rb
308
+ - lib/selenium/webdriver/devtools/service_worker.rb
309
+ - lib/selenium/webdriver/devtools/storage.rb
310
+ - lib/selenium/webdriver/devtools/system_info.rb
311
+ - lib/selenium/webdriver/devtools/target.rb
312
+ - lib/selenium/webdriver/devtools/tethering.rb
313
+ - lib/selenium/webdriver/devtools/tracing.rb
314
+ - lib/selenium/webdriver/devtools/web_audio.rb
315
+ - lib/selenium/webdriver/devtools/web_authn.rb
269
316
  - lib/selenium/webdriver/edge.rb
270
317
  - lib/selenium/webdriver/edge_chrome/bridge.rb
271
318
  - lib/selenium/webdriver/edge_chrome/driver.rb
@@ -306,6 +353,7 @@ files:
306
353
  - lib/selenium/webdriver/support.rb
307
354
  - lib/selenium/webdriver/support/abstract_event_listener.rb
308
355
  - lib/selenium/webdriver/support/block_event_listener.rb
356
+ - lib/selenium/webdriver/support/cdp_client_generator.rb
309
357
  - lib/selenium/webdriver/support/color.rb
310
358
  - lib/selenium/webdriver/support/escaper.rb
311
359
  - lib/selenium/webdriver/support/event_firing_bridge.rb
@@ -327,7 +375,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
375
  requirements:
328
376
  - - ">="
329
377
  - !ruby/object:Gem::Version
330
- version: '2.4'
378
+ version: '2.5'
331
379
  required_rubygems_version: !ruby/object:Gem::Requirement
332
380
  requirements:
333
381
  - - ">"