selenium-webdriver 4.0.0.alpha1 → 4.0.0.alpha6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +139 -1
  3. data/LICENSE +1 -1
  4. data/lib/selenium/server.rb +3 -3
  5. data/lib/selenium/webdriver.rb +11 -7
  6. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  7. data/lib/selenium/webdriver/atoms/getAttribute.js +84 -7
  8. data/lib/selenium/webdriver/atoms/isDisplayed.js +75 -77
  9. data/lib/selenium/webdriver/chrome.rb +10 -9
  10. data/lib/selenium/webdriver/chrome/bridge.rb +20 -4
  11. data/lib/selenium/webdriver/chrome/driver.rb +3 -52
  12. data/lib/selenium/webdriver/chrome/options.rb +97 -57
  13. data/lib/selenium/webdriver/chrome/profile.rb +2 -2
  14. data/lib/selenium/webdriver/chrome/service.rb +0 -4
  15. data/lib/selenium/webdriver/common.rb +3 -0
  16. data/lib/selenium/webdriver/common/driver.rb +76 -17
  17. data/lib/selenium/webdriver/common/driver_extensions/{has_touch_screen.rb → has_devtools.rb} +10 -8
  18. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -1
  19. data/lib/selenium/webdriver/common/logger.rb +48 -16
  20. data/lib/selenium/webdriver/common/manager.rb +5 -0
  21. data/lib/selenium/webdriver/common/options.rb +60 -121
  22. data/lib/selenium/webdriver/common/platform.rb +3 -0
  23. data/lib/selenium/webdriver/common/port_prober.rb +4 -6
  24. data/lib/selenium/webdriver/common/profile_helper.rb +10 -2
  25. data/lib/selenium/webdriver/common/proxy.rb +0 -0
  26. data/lib/selenium/webdriver/common/search_context.rb +3 -2
  27. data/lib/selenium/webdriver/common/service.rb +30 -113
  28. data/lib/selenium/webdriver/common/service_manager.rb +151 -0
  29. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  30. data/lib/selenium/webdriver/common/wait.rb +1 -1
  31. data/lib/selenium/webdriver/devtools.rb +118 -0
  32. data/lib/selenium/webdriver/devtools/accessibility.rb +62 -0
  33. data/lib/selenium/webdriver/devtools/animation.rb +98 -0
  34. data/lib/selenium/webdriver/devtools/application_cache.rb +64 -0
  35. data/lib/selenium/webdriver/devtools/audits.rb +61 -0
  36. data/lib/selenium/webdriver/devtools/background_service.rb +67 -0
  37. data/lib/selenium/webdriver/devtools/browser.rb +123 -0
  38. data/lib/selenium/webdriver/devtools/cache_storage.rb +73 -0
  39. data/lib/selenium/webdriver/devtools/cast.rb +70 -0
  40. data/lib/selenium/webdriver/devtools/console.rb +57 -0
  41. data/lib/selenium/webdriver/devtools/css.rb +165 -0
  42. data/lib/selenium/webdriver/devtools/database.rb +64 -0
  43. data/lib/selenium/webdriver/devtools/debugger.rb +229 -0
  44. data/lib/selenium/webdriver/devtools/device_orientation.rb +53 -0
  45. data/lib/selenium/webdriver/devtools/dom.rb +320 -0
  46. data/lib/selenium/webdriver/devtools/domdebugger.rb +93 -0
  47. data/lib/selenium/webdriver/devtools/domsnapshot.rb +65 -0
  48. data/lib/selenium/webdriver/devtools/domstorage.rb +79 -0
  49. data/lib/selenium/webdriver/devtools/emulation.rb +180 -0
  50. data/lib/selenium/webdriver/devtools/fetch.rb +97 -0
  51. data/lib/selenium/webdriver/devtools/headless_experimental.rb +61 -0
  52. data/lib/selenium/webdriver/devtools/heap_profiler.rb +107 -0
  53. data/lib/selenium/webdriver/devtools/indexed_db.rb +100 -0
  54. data/lib/selenium/webdriver/devtools/input.rb +140 -0
  55. data/lib/selenium/webdriver/devtools/inspector.rb +55 -0
  56. data/lib/selenium/webdriver/devtools/io.rb +59 -0
  57. data/lib/selenium/webdriver/devtools/layer_tree.rb +95 -0
  58. data/lib/selenium/webdriver/devtools/log.rb +66 -0
  59. data/lib/selenium/webdriver/devtools/media.rb +57 -0
  60. data/lib/selenium/webdriver/devtools/memory.rb +86 -0
  61. data/lib/selenium/webdriver/devtools/network.rb +228 -0
  62. data/lib/selenium/webdriver/devtools/overlay.rb +157 -0
  63. data/lib/selenium/webdriver/devtools/page.rb +374 -0
  64. data/lib/selenium/webdriver/devtools/performance.rb +63 -0
  65. data/lib/selenium/webdriver/devtools/profiler.rb +111 -0
  66. data/lib/selenium/webdriver/devtools/runtime.rb +193 -0
  67. data/lib/selenium/webdriver/devtools/schema.rb +46 -0
  68. data/lib/selenium/webdriver/devtools/security.rb +71 -0
  69. data/lib/selenium/webdriver/devtools/service_worker.rb +116 -0
  70. data/lib/selenium/webdriver/devtools/storage.rb +95 -0
  71. data/lib/selenium/webdriver/devtools/system_info.rb +50 -0
  72. data/lib/selenium/webdriver/devtools/target.rb +141 -0
  73. data/lib/selenium/webdriver/devtools/tethering.rb +55 -0
  74. data/lib/selenium/webdriver/devtools/tracing.rb +76 -0
  75. data/lib/selenium/webdriver/devtools/web_audio.rb +70 -0
  76. data/lib/selenium/webdriver/devtools/web_authn.rb +94 -0
  77. data/lib/selenium/webdriver/edge.rb +29 -9
  78. data/lib/selenium/webdriver/{firefox/util.rb → edge_chrome/bridge.rb} +11 -20
  79. data/lib/selenium/webdriver/{common/w3c_options.rb → edge_chrome/driver.rb} +14 -17
  80. data/lib/selenium/webdriver/edge_chrome/options.rb +36 -0
  81. data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
  82. data/lib/selenium/webdriver/edge_chrome/service.rb +36 -0
  83. data/lib/selenium/webdriver/{common/w3c_manager.rb → edge_html/driver.rb} +11 -17
  84. data/lib/selenium/webdriver/{edge → edge_html}/options.rb +26 -22
  85. data/lib/selenium/webdriver/{edge → edge_html}/service.rb +2 -6
  86. data/lib/selenium/webdriver/firefox.rb +18 -15
  87. data/lib/selenium/webdriver/firefox/bridge.rb +1 -1
  88. data/lib/selenium/webdriver/firefox/driver.rb +2 -30
  89. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  90. data/lib/selenium/webdriver/firefox/options.rb +47 -52
  91. data/lib/selenium/webdriver/firefox/profile.rb +7 -78
  92. data/lib/selenium/webdriver/firefox/service.rb +0 -4
  93. data/lib/selenium/webdriver/ie.rb +8 -7
  94. data/lib/selenium/webdriver/ie/driver.rb +0 -32
  95. data/lib/selenium/webdriver/ie/options.rb +10 -33
  96. data/lib/selenium/webdriver/ie/service.rb +5 -9
  97. data/lib/selenium/webdriver/remote.rb +16 -10
  98. data/lib/selenium/webdriver/remote/bridge.rb +34 -42
  99. data/lib/selenium/webdriver/remote/capabilities.rb +22 -6
  100. data/lib/selenium/webdriver/remote/driver.rb +6 -12
  101. data/lib/selenium/webdriver/remote/http/default.rb +9 -4
  102. data/lib/selenium/webdriver/remote/http/persistent.rb +5 -6
  103. data/lib/selenium/webdriver/safari.rb +9 -8
  104. data/lib/selenium/webdriver/safari/bridge.rb +4 -4
  105. data/lib/selenium/webdriver/safari/driver.rb +3 -29
  106. data/lib/selenium/webdriver/safari/options.rb +18 -19
  107. data/lib/selenium/webdriver/safari/service.rb +0 -4
  108. data/lib/selenium/webdriver/support.rb +1 -0
  109. data/lib/selenium/webdriver/support/cdp_client_generator.rb +77 -0
  110. data/lib/selenium/webdriver/support/color.rb +2 -2
  111. data/lib/selenium/webdriver/support/event_firing_bridge.rb +1 -1
  112. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  113. data/lib/selenium/webdriver/version.rb +1 -1
  114. data/selenium-webdriver.gemspec +5 -4
  115. metadata +81 -42
  116. data/lib/selenium/webdriver/common/bridge_helper.rb +0 -82
  117. data/lib/selenium/webdriver/common/keyboard.rb +0 -70
  118. data/lib/selenium/webdriver/common/mouse.rb +0 -89
  119. data/lib/selenium/webdriver/common/touch_action_builder.rb +0 -78
  120. data/lib/selenium/webdriver/common/touch_screen.rb +0 -123
  121. data/lib/selenium/webdriver/common/w3c_action_builder.rb +0 -212
  122. data/lib/selenium/webdriver/edge/bridge.rb +0 -76
  123. data/lib/selenium/webdriver/edge/driver.rb +0 -70
  124. data/lib/selenium/webdriver/firefox/binary.rb +0 -110
  125. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
  126. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  127. data/lib/selenium/webdriver/firefox/launcher.rb +0 -111
  128. data/lib/selenium/webdriver/firefox/legacy/driver.rb +0 -83
  129. data/lib/selenium/webdriver/firefox/marionette/bridge.rb +0 -49
  130. data/lib/selenium/webdriver/firefox/marionette/driver.rb +0 -90
  131. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  132. data/lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so +0 -0
  133. data/lib/selenium/webdriver/remote/oss/bridge.rb +0 -594
  134. data/lib/selenium/webdriver/remote/oss/commands.rb +0 -223
  135. data/lib/selenium/webdriver/remote/w3c/bridge.rb +0 -605
  136. data/lib/selenium/webdriver/remote/w3c/capabilities.rb +0 -310
  137. data/lib/selenium/webdriver/remote/w3c/commands.rb +0 -157
@@ -59,10 +59,15 @@ module Selenium
59
59
  http.open_timeout = open_timeout
60
60
  http.read_timeout = read_timeout if read_timeout
61
61
 
62
- http.start
62
+ start(http)
63
+ http
63
64
  end
64
65
  end
65
66
 
67
+ def start(http)
68
+ http.start
69
+ end
70
+
66
71
  MAX_RETRIES = 3
67
72
 
68
73
  def request(verb, url, headers, payload, redirects = 0)
@@ -84,15 +89,15 @@ module Selenium
84
89
  retries += 1
85
90
  sleep 2
86
91
  retry
87
- rescue Errno::EADDRNOTAVAIL => ex
92
+ rescue Errno::EADDRNOTAVAIL => e
88
93
  # a retry is sometimes needed when the port becomes temporarily unavailable
89
94
  raise if retries >= MAX_RETRIES
90
95
 
91
96
  retries += 1
92
97
  sleep 2
93
98
  retry
94
- rescue Errno::ECONNREFUSED => ex
95
- raise ex.class, "using proxy: #{proxy.http}" if use_proxy?
99
+ rescue Errno::ECONNREFUSED => e
100
+ raise e.class, "using proxy: #{proxy.http}" if use_proxy?
96
101
 
97
102
  raise
98
103
  end
@@ -31,6 +31,10 @@ module Selenium
31
31
 
32
32
  private
33
33
 
34
+ def start(*)
35
+ # no need to explicitly start connection
36
+ end
37
+
34
38
  def new_http_client
35
39
  proxy = nil
36
40
 
@@ -42,12 +46,7 @@ module Selenium
42
46
  proxy = URI.parse(url)
43
47
  end
44
48
 
45
- if Net::HTTP::Persistent::VERSION >= '3'
46
- Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
47
- else
48
- WebDriver.logger.warn 'Support for this version of net-http-persistent is deprecated. Please upgrade.'
49
- Net::HTTP::Persistent.new 'webdriver', proxy
50
- end
49
+ Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
51
50
  end
52
51
 
53
52
  def response_for(request)
@@ -17,13 +17,14 @@
17
17
  # specific language governing permissions and limitations
18
18
  # under the License.
19
19
 
20
- require 'selenium/webdriver/safari/bridge'
21
- require 'selenium/webdriver/safari/driver'
22
- require 'selenium/webdriver/safari/options'
23
-
24
20
  module Selenium
25
21
  module WebDriver
26
22
  module Safari
23
+ autoload :Bridge, 'selenium/webdriver/safari/bridge'
24
+ autoload :Driver, 'selenium/webdriver/safari/driver'
25
+ autoload :Options, 'selenium/webdriver/safari/options'
26
+ autoload :Service, 'selenium/webdriver/safari/service'
27
+
27
28
  class << self
28
29
  def technology_preview
29
30
  "/Applications/Safari\ Technology\ Preview.app/Contents/MacOS/safaridriver"
@@ -48,18 +49,18 @@ module Selenium
48
49
 
49
50
  def driver_path=(path)
50
51
  WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
51
- 'Selenium::WebDriver::Safari::Service#driver_path='
52
+ 'Selenium::WebDriver::Safari::Service#driver_path=',
53
+ id: :driver_path
52
54
  Selenium::WebDriver::Safari::Service.driver_path = path
53
55
  end
54
56
 
55
57
  def driver_path
56
58
  WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
57
- 'Selenium::WebDriver::Safari::Service#driver_path'
59
+ 'Selenium::WebDriver::Safari::Service#driver_path',
60
+ id: :driver_path
58
61
  Selenium::WebDriver::Safari::Service.driver_path
59
62
  end
60
63
  end
61
64
  end # Safari
62
65
  end # WebDriver
63
66
  end # Selenium
64
-
65
- require 'selenium/webdriver/safari/service'
@@ -20,13 +20,13 @@
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 = {
27
- get_permissions: [:get, '/session/:session_id/apple/permissions'],
28
- set_permissions: [:post, '/session/:session_id/apple/permissions'],
29
- attach_debugger: [:post, '/session/:session_id/apple/attach_debugger']
27
+ get_permissions: [:get, 'session/:session_id/apple/permissions'],
28
+ set_permissions: [:post, 'session/:session_id/apple/permissions'],
29
+ attach_debugger: [:post, 'session/:session_id/apple/attach_debugger']
30
30
  }.freeze
31
31
 
32
32
  def commands(command)
@@ -29,42 +29,16 @@ module Selenium
29
29
  class Driver < WebDriver::Driver
30
30
  include DriverExtensions::HasDebugger
31
31
  include DriverExtensions::HasPermissions
32
+ include DriverExtensions::HasWebStorage
32
33
  include DriverExtensions::TakesScreenshot
33
34
 
34
- def initialize(opts = {})
35
- opts[:desired_capabilities] = create_capabilities(opts)
36
-
37
- opts[:url] ||= service_url(opts)
38
-
39
- listener = opts.delete(:listener)
40
- desired_capabilities = opts.delete(:desired_capabilities)
41
-
42
- @bridge = Remote::Bridge.new(opts)
43
- @bridge.extend Bridge
44
- @bridge.create_session(desired_capabilities)
45
-
46
- super(@bridge, listener: listener)
47
- end
48
-
49
35
  def browser
50
36
  :safari
51
37
  end
52
38
 
53
- def quit
54
- super
55
- ensure
56
- @service&.stop
39
+ def bridge_class
40
+ Bridge
57
41
  end
58
-
59
- private
60
-
61
- def create_capabilities(opts = {})
62
- caps = opts.delete(:desired_capabilities) { Remote::Capabilities.safari }
63
- options = opts.delete(:options) { Options.new }
64
- caps.merge!(options.as_json)
65
- caps
66
- end
67
-
68
42
  end # Driver
69
43
  end # Safari
70
44
  end # WebDriver
@@ -20,8 +20,23 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Safari
23
- class Options
24
- attr_accessor :automatic_inspection, :automatic_profiling
23
+ class Options < WebDriver::Options
24
+ attr_accessor :options
25
+
26
+ # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
27
+ CAPABILITIES = {automatic_inspection: 'safari:automaticInspection',
28
+ automatic_profiling: 'safari:automaticProfiling'}.freeze
29
+ BROWSER = 'safari'
30
+
31
+ CAPABILITIES.each_key do |key|
32
+ define_method key do
33
+ @options[key]
34
+ end
35
+
36
+ define_method "#{key}=" do |value|
37
+ @options[key] = value
38
+ end
39
+ end
25
40
 
26
41
  #
27
42
  # Create a new Options instance for W3C-capable versions of Safari.
@@ -34,25 +49,9 @@ module Selenium
34
49
  # @option opts [Boolean] :automatic_inspection Preloads Web Inspector and JavaScript debugger. Default is false
35
50
  # @option opts [Boolean] :automatic_profiling Preloads Web Inspector and starts a timeline recording. Default is false
36
51
  #
37
- # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
38
- #
39
52
 
40
53
  def initialize(**opts)
41
- @automatic_inspection = opts.delete(:automatic_inspection) || false
42
- @automatic_profiling = opts.delete(:automatic_profiling) || false
43
- end
44
-
45
- #
46
- # @api private
47
- #
48
-
49
- def as_json(*)
50
- opts = {}
51
-
52
- opts['safari:automaticInspection'] = true if @automatic_inspection
53
- opts['safari:automaticProfiling'] = true if @automatic_profiling
54
-
55
- opts
54
+ super
56
55
  end
57
56
  end # Options
58
57
  end # Safari
@@ -20,10 +20,6 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Safari
23
- #
24
- # @api private
25
- #
26
-
27
23
  class Service < WebDriver::Service
28
24
  DEFAULT_PORT = 7050
29
25
  EXECUTABLE = 'safaridriver'
@@ -23,3 +23,4 @@ require 'selenium/webdriver/support/block_event_listener'
23
23
  require 'selenium/webdriver/support/escaper'
24
24
  require 'selenium/webdriver/support/select'
25
25
  require 'selenium/webdriver/support/color'
26
+ require 'selenium/webdriver/support/relative_locator'
@@ -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
@@ -109,7 +109,7 @@ module Selenium
109
109
  end
110
110
 
111
111
  def driver
112
- @driver ||= Driver.new(self)
112
+ @driver ||= Driver.new(bridge: self)
113
113
  end
114
114
 
115
115
  def dispatch(name, *args)
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Selenium
21
+ module WebDriver
22
+ module Support
23
+
24
+ #
25
+ # @api private
26
+ #
27
+
28
+ class RelativeLocator
29
+ KEYS = %w[above below left right near distance].freeze
30
+
31
+ def initialize(locator)
32
+ @filters, @root = locator.partition { |how, _| KEYS.include?(how) }.map(&:to_h)
33
+ end
34
+
35
+ def as_json
36
+ {
37
+ relative: {
38
+ root: @root,
39
+ filters: @filters.map do |kind, filter|
40
+ {
41
+ kind: kind,
42
+ args: [filter]
43
+ }
44
+ end
45
+ }
46
+ }
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.0.0.alpha1'
22
+ VERSION = '4.0.0.alpha6'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -26,20 +26,21 @@ 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']
33
33
 
34
- s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 2.0']
35
- s.add_runtime_dependency 'rubyzip', ['~> 1.2', '>= 1.2.2']
34
+ s.add_runtime_dependency 'childprocess', ['>= 0.5', '< 4.0']
35
+ s.add_runtime_dependency 'rubyzip', ['>= 1.2.2']
36
+ s.add_runtime_dependency 'websocket', ['~> 1.0']
36
37
 
37
38
  # childprocess requires ffi on windows but doesn't declare it in its dependencies
38
39
  s.add_development_dependency 'ffi'
39
40
  s.add_development_dependency 'rack', ['~> 2.0']
40
41
  s.add_development_dependency 'rake'
41
42
  s.add_development_dependency 'rspec', ['~> 3.0']
42
- s.add_development_dependency 'rubocop', ['~> 0.67.0']
43
+ s.add_development_dependency 'rubocop', ['~> 0.84.0']
43
44
  s.add_development_dependency 'rubocop-performance'
44
45
  s.add_development_dependency 'rubocop-rspec'
45
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.alpha1
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: 2019-05-01 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
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '0.5'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '2.0'
23
+ version: '4.0'
24
24
  name: childprocess
25
25
  prerelease: false
26
26
  type: :runtime
@@ -31,13 +31,10 @@ dependencies:
31
31
  version: '0.5'
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.0'
34
+ version: '4.0'
35
35
  - !ruby/object:Gem::Dependency
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.2'
41
38
  - - ">="
42
39
  - !ruby/object:Gem::Version
43
40
  version: 1.2.2
@@ -46,12 +43,23 @@ dependencies:
46
43
  type: :runtime
47
44
  version_requirements: !ruby/object:Gem::Requirement
48
45
  requirements:
49
- - - "~>"
50
- - !ruby/object:Gem::Version
51
- version: '1.2'
52
46
  - - ">="
53
47
  - !ruby/object:Gem::Version
54
48
  version: 1.2.2
49
+ - !ruby/object:Gem::Dependency
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ name: websocket
56
+ prerelease: false
57
+ type: :runtime
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.0'
55
63
  - !ruby/object:Gem::Dependency
56
64
  requirement: !ruby/object:Gem::Requirement
57
65
  requirements:
@@ -113,7 +121,7 @@ dependencies:
113
121
  requirements:
114
122
  - - "~>"
115
123
  - !ruby/object:Gem::Version
116
- version: 0.67.0
124
+ version: 0.84.0
117
125
  name: rubocop
118
126
  prerelease: false
119
127
  type: :development
@@ -121,7 +129,7 @@ dependencies:
121
129
  requirements:
122
130
  - - "~>"
123
131
  - !ruby/object:Gem::Version
124
- version: 0.67.0
132
+ version: 0.84.0
125
133
  - !ruby/object:Gem::Dependency
126
134
  requirement: !ruby/object:Gem::Requirement
127
135
  requirements:
@@ -197,6 +205,7 @@ files:
197
205
  - lib/selenium/server.rb
198
206
  - lib/selenium/webdriver.rb
199
207
  - lib/selenium/webdriver/atoms.rb
208
+ - lib/selenium/webdriver/atoms/findElements.js
200
209
  - lib/selenium/webdriver/atoms/getAttribute.js
201
210
  - lib/selenium/webdriver/atoms/isDisplayed.js
202
211
  - lib/selenium/webdriver/chrome.rb
@@ -208,18 +217,17 @@ files:
208
217
  - lib/selenium/webdriver/common.rb
209
218
  - lib/selenium/webdriver/common/action_builder.rb
210
219
  - lib/selenium/webdriver/common/alert.rb
211
- - lib/selenium/webdriver/common/bridge_helper.rb
212
220
  - lib/selenium/webdriver/common/driver.rb
213
221
  - lib/selenium/webdriver/common/driver_extensions/downloads_files.rb
214
222
  - lib/selenium/webdriver/common/driver_extensions/has_addons.rb
215
223
  - lib/selenium/webdriver/common/driver_extensions/has_debugger.rb
224
+ - lib/selenium/webdriver/common/driver_extensions/has_devtools.rb
216
225
  - lib/selenium/webdriver/common/driver_extensions/has_location.rb
217
226
  - lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb
218
227
  - lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb
219
228
  - lib/selenium/webdriver/common/driver_extensions/has_permissions.rb
220
229
  - lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb
221
230
  - lib/selenium/webdriver/common/driver_extensions/has_session_id.rb
222
- - lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb
223
231
  - lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb
224
232
  - lib/selenium/webdriver/common/driver_extensions/rotatable.rb
225
233
  - lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb
@@ -238,13 +246,11 @@ files:
238
246
  - lib/selenium/webdriver/common/interactions/none_input.rb
239
247
  - lib/selenium/webdriver/common/interactions/pointer_actions.rb
240
248
  - lib/selenium/webdriver/common/interactions/pointer_input.rb
241
- - lib/selenium/webdriver/common/keyboard.rb
242
249
  - lib/selenium/webdriver/common/keys.rb
243
250
  - lib/selenium/webdriver/common/log_entry.rb
244
251
  - lib/selenium/webdriver/common/logger.rb
245
252
  - lib/selenium/webdriver/common/logs.rb
246
253
  - lib/selenium/webdriver/common/manager.rb
247
- - lib/selenium/webdriver/common/mouse.rb
248
254
  - lib/selenium/webdriver/common/navigation.rb
249
255
  - lib/selenium/webdriver/common/options.rb
250
256
  - lib/selenium/webdriver/common/platform.rb
@@ -253,41 +259,77 @@ files:
253
259
  - lib/selenium/webdriver/common/proxy.rb
254
260
  - lib/selenium/webdriver/common/search_context.rb
255
261
  - lib/selenium/webdriver/common/service.rb
262
+ - lib/selenium/webdriver/common/service_manager.rb
256
263
  - lib/selenium/webdriver/common/socket_lock.rb
257
264
  - lib/selenium/webdriver/common/socket_poller.rb
258
265
  - lib/selenium/webdriver/common/target_locator.rb
259
266
  - lib/selenium/webdriver/common/timeouts.rb
260
- - lib/selenium/webdriver/common/touch_action_builder.rb
261
- - lib/selenium/webdriver/common/touch_screen.rb
262
- - lib/selenium/webdriver/common/w3c_action_builder.rb
263
- - lib/selenium/webdriver/common/w3c_manager.rb
264
- - lib/selenium/webdriver/common/w3c_options.rb
265
267
  - lib/selenium/webdriver/common/wait.rb
266
268
  - lib/selenium/webdriver/common/window.rb
267
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
268
316
  - lib/selenium/webdriver/edge.rb
269
- - lib/selenium/webdriver/edge/bridge.rb
270
- - lib/selenium/webdriver/edge/driver.rb
271
- - lib/selenium/webdriver/edge/options.rb
272
- - lib/selenium/webdriver/edge/service.rb
317
+ - lib/selenium/webdriver/edge_chrome/bridge.rb
318
+ - lib/selenium/webdriver/edge_chrome/driver.rb
319
+ - lib/selenium/webdriver/edge_chrome/options.rb
320
+ - lib/selenium/webdriver/edge_chrome/profile.rb
321
+ - lib/selenium/webdriver/edge_chrome/service.rb
322
+ - lib/selenium/webdriver/edge_html/driver.rb
323
+ - lib/selenium/webdriver/edge_html/options.rb
324
+ - lib/selenium/webdriver/edge_html/service.rb
273
325
  - lib/selenium/webdriver/firefox.rb
274
- - lib/selenium/webdriver/firefox/binary.rb
275
326
  - lib/selenium/webdriver/firefox/bridge.rb
276
327
  - lib/selenium/webdriver/firefox/driver.rb
277
328
  - lib/selenium/webdriver/firefox/extension.rb
278
- - lib/selenium/webdriver/firefox/extension/prefs.json
279
- - lib/selenium/webdriver/firefox/extension/webdriver.xpi
280
- - lib/selenium/webdriver/firefox/launcher.rb
281
- - lib/selenium/webdriver/firefox/legacy/driver.rb
282
- - lib/selenium/webdriver/firefox/marionette/bridge.rb
283
- - lib/selenium/webdriver/firefox/marionette/driver.rb
284
- - lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
285
- - lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
286
329
  - lib/selenium/webdriver/firefox/options.rb
287
330
  - lib/selenium/webdriver/firefox/profile.rb
288
331
  - lib/selenium/webdriver/firefox/profiles_ini.rb
289
332
  - lib/selenium/webdriver/firefox/service.rb
290
- - lib/selenium/webdriver/firefox/util.rb
291
333
  - lib/selenium/webdriver/ie.rb
292
334
  - lib/selenium/webdriver/ie/driver.rb
293
335
  - lib/selenium/webdriver/ie/options.rb
@@ -301,13 +343,8 @@ files:
301
343
  - lib/selenium/webdriver/remote/http/curb.rb
302
344
  - lib/selenium/webdriver/remote/http/default.rb
303
345
  - lib/selenium/webdriver/remote/http/persistent.rb
304
- - lib/selenium/webdriver/remote/oss/bridge.rb
305
- - lib/selenium/webdriver/remote/oss/commands.rb
306
346
  - lib/selenium/webdriver/remote/response.rb
307
347
  - lib/selenium/webdriver/remote/server_error.rb
308
- - lib/selenium/webdriver/remote/w3c/bridge.rb
309
- - lib/selenium/webdriver/remote/w3c/capabilities.rb
310
- - lib/selenium/webdriver/remote/w3c/commands.rb
311
348
  - lib/selenium/webdriver/safari.rb
312
349
  - lib/selenium/webdriver/safari/bridge.rb
313
350
  - lib/selenium/webdriver/safari/driver.rb
@@ -316,9 +353,11 @@ files:
316
353
  - lib/selenium/webdriver/support.rb
317
354
  - lib/selenium/webdriver/support/abstract_event_listener.rb
318
355
  - lib/selenium/webdriver/support/block_event_listener.rb
356
+ - lib/selenium/webdriver/support/cdp_client_generator.rb
319
357
  - lib/selenium/webdriver/support/color.rb
320
358
  - lib/selenium/webdriver/support/escaper.rb
321
359
  - lib/selenium/webdriver/support/event_firing_bridge.rb
360
+ - lib/selenium/webdriver/support/relative_locator.rb
322
361
  - lib/selenium/webdriver/support/select.rb
323
362
  - lib/selenium/webdriver/version.rb
324
363
  - selenium-webdriver.gemspec
@@ -336,7 +375,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
336
375
  requirements:
337
376
  - - ">="
338
377
  - !ruby/object:Gem::Version
339
- version: '2.4'
378
+ version: '2.5'
340
379
  required_rubygems_version: !ruby/object:Gem::Requirement
341
380
  requirements:
342
381
  - - ">"
@@ -344,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
383
  version: 1.3.1
345
384
  requirements: []
346
385
  rubyforge_project:
347
- rubygems_version: 2.6.14
386
+ rubygems_version: 2.7.9
348
387
  signing_key:
349
388
  specification_version: 4
350
389
  summary: The next generation developer focused tool for automated testing of webapps