selenium-webdriver 4.0.0.alpha3 → 4.0.0.alpha4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +50 -1
  3. data/lib/selenium/server.rb +1 -1
  4. data/lib/selenium/webdriver.rb +2 -0
  5. data/lib/selenium/webdriver/atoms/findElements.js +122 -0
  6. data/lib/selenium/webdriver/atoms/getAttribute.js +84 -7
  7. data/lib/selenium/webdriver/atoms/isDisplayed.js +75 -77
  8. data/lib/selenium/webdriver/chrome.rb +4 -2
  9. data/lib/selenium/webdriver/chrome/driver.rb +1 -16
  10. data/lib/selenium/webdriver/chrome/options.rb +1 -1
  11. data/lib/selenium/webdriver/chrome/service.rb +0 -4
  12. data/lib/selenium/webdriver/common.rb +1 -0
  13. data/lib/selenium/webdriver/common/driver.rb +25 -5
  14. data/lib/selenium/webdriver/common/driver_extensions/has_devtools.rb +38 -0
  15. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +2 -1
  16. data/lib/selenium/webdriver/common/logger.rb +47 -15
  17. data/lib/selenium/webdriver/common/options.rb +2 -1
  18. data/lib/selenium/webdriver/common/platform.rb +3 -0
  19. data/lib/selenium/webdriver/common/port_prober.rb +2 -2
  20. data/lib/selenium/webdriver/common/proxy.rb +0 -0
  21. data/lib/selenium/webdriver/common/search_context.rb +3 -2
  22. data/lib/selenium/webdriver/common/service.rb +0 -13
  23. data/lib/selenium/webdriver/common/socket_lock.rb +2 -2
  24. data/lib/selenium/webdriver/common/wait.rb +1 -1
  25. data/lib/selenium/webdriver/edge.rb +4 -2
  26. data/lib/selenium/webdriver/edge_chrome/driver.rb +1 -1
  27. data/lib/selenium/webdriver/edge_chrome/service.rb +0 -4
  28. data/lib/selenium/webdriver/edge_html/driver.rb +1 -15
  29. data/lib/selenium/webdriver/edge_html/options.rb +1 -1
  30. data/lib/selenium/webdriver/edge_html/service.rb +1 -5
  31. data/lib/selenium/webdriver/firefox.rb +10 -4
  32. data/lib/selenium/webdriver/firefox/driver.rb +0 -16
  33. data/lib/selenium/webdriver/firefox/options.rb +4 -1
  34. data/lib/selenium/webdriver/firefox/profile.rb +4 -77
  35. data/lib/selenium/webdriver/firefox/service.rb +0 -4
  36. data/lib/selenium/webdriver/ie.rb +4 -2
  37. data/lib/selenium/webdriver/ie/driver.rb +0 -15
  38. data/lib/selenium/webdriver/ie/service.rb +5 -9
  39. data/lib/selenium/webdriver/remote/bridge.rb +31 -29
  40. data/lib/selenium/webdriver/remote/capabilities.rb +1 -0
  41. data/lib/selenium/webdriver/remote/driver.rb +6 -12
  42. data/lib/selenium/webdriver/remote/http/default.rb +3 -3
  43. data/lib/selenium/webdriver/safari.rb +4 -2
  44. data/lib/selenium/webdriver/safari/driver.rb +0 -16
  45. data/lib/selenium/webdriver/safari/service.rb +0 -4
  46. data/lib/selenium/webdriver/support.rb +1 -0
  47. data/lib/selenium/webdriver/support/event_firing_bridge.rb +1 -1
  48. data/lib/selenium/webdriver/support/relative_locator.rb +51 -0
  49. data/lib/selenium/webdriver/version.rb +1 -1
  50. data/selenium-webdriver.gemspec +4 -3
  51. metadata +24 -15
  52. data/lib/selenium/webdriver/firefox/binary.rb +0 -110
  53. data/lib/selenium/webdriver/firefox/extension/prefs.json +0 -69
@@ -89,15 +89,15 @@ module Selenium
89
89
  retries += 1
90
90
  sleep 2
91
91
  retry
92
- rescue Errno::EADDRNOTAVAIL => ex
92
+ rescue Errno::EADDRNOTAVAIL => e
93
93
  # a retry is sometimes needed when the port becomes temporarily unavailable
94
94
  raise if retries >= MAX_RETRIES
95
95
 
96
96
  retries += 1
97
97
  sleep 2
98
98
  retry
99
- rescue Errno::ECONNREFUSED => ex
100
- 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?
101
101
 
102
102
  raise
103
103
  end
@@ -49,13 +49,15 @@ module Selenium
49
49
 
50
50
  def driver_path=(path)
51
51
  WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path=',
52
- 'Selenium::WebDriver::Safari::Service#driver_path='
52
+ 'Selenium::WebDriver::Safari::Service#driver_path=',
53
+ id: :driver_path
53
54
  Selenium::WebDriver::Safari::Service.driver_path = path
54
55
  end
55
56
 
56
57
  def driver_path
57
58
  WebDriver.logger.deprecate 'Selenium::WebDriver::Safari#driver_path',
58
- 'Selenium::WebDriver::Safari::Service#driver_path'
59
+ 'Selenium::WebDriver::Safari::Service#driver_path',
60
+ id: :driver_path
59
61
  Selenium::WebDriver::Safari::Service.driver_path
60
62
  end
61
63
  end
@@ -32,22 +32,6 @@ module Selenium
32
32
  include DriverExtensions::HasWebStorage
33
33
  include DriverExtensions::TakesScreenshot
34
34
 
35
- def initialize(opts = {})
36
- opts[:desired_capabilities] ||= Remote::Capabilities.safari
37
-
38
- opts[:url] ||= service_url(opts)
39
-
40
- listener = opts.delete(:listener)
41
- desired_capabilities = opts.delete(:desired_capabilities)
42
- options = opts.delete(:options)
43
-
44
- @bridge = Remote::Bridge.new(opts)
45
- @bridge.extend Bridge
46
- @bridge.create_session(desired_capabilities, options)
47
-
48
- super(@bridge, listener: listener)
49
- end
50
-
51
35
  def browser
52
36
  :safari
53
37
  end
@@ -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'
@@ -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.alpha3'
22
+ VERSION = '4.0.0.alpha4'
23
23
  end # WebDriver
24
24
  end # Selenium
@@ -31,15 +31,16 @@ Gem::Specification.new do |s|
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.73.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.alpha3
4
+ version: 4.0.0.alpha4
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-07-08 00:00:00.000000000 Z
13
+ date: 2020-01-09 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.73.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.73.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
@@ -212,6 +221,7 @@ files:
212
221
  - lib/selenium/webdriver/common/driver_extensions/downloads_files.rb
213
222
  - lib/selenium/webdriver/common/driver_extensions/has_addons.rb
214
223
  - lib/selenium/webdriver/common/driver_extensions/has_debugger.rb
224
+ - lib/selenium/webdriver/common/driver_extensions/has_devtools.rb
215
225
  - lib/selenium/webdriver/common/driver_extensions/has_location.rb
216
226
  - lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb
217
227
  - lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb
@@ -266,11 +276,9 @@ files:
266
276
  - lib/selenium/webdriver/edge_html/options.rb
267
277
  - lib/selenium/webdriver/edge_html/service.rb
268
278
  - lib/selenium/webdriver/firefox.rb
269
- - lib/selenium/webdriver/firefox/binary.rb
270
279
  - lib/selenium/webdriver/firefox/bridge.rb
271
280
  - lib/selenium/webdriver/firefox/driver.rb
272
281
  - lib/selenium/webdriver/firefox/extension.rb
273
- - lib/selenium/webdriver/firefox/extension/prefs.json
274
282
  - lib/selenium/webdriver/firefox/options.rb
275
283
  - lib/selenium/webdriver/firefox/profile.rb
276
284
  - lib/selenium/webdriver/firefox/profiles_ini.rb
@@ -301,6 +309,7 @@ files:
301
309
  - lib/selenium/webdriver/support/color.rb
302
310
  - lib/selenium/webdriver/support/escaper.rb
303
311
  - lib/selenium/webdriver/support/event_firing_bridge.rb
312
+ - lib/selenium/webdriver/support/relative_locator.rb
304
313
  - lib/selenium/webdriver/support/select.rb
305
314
  - lib/selenium/webdriver/version.rb
306
315
  - selenium-webdriver.gemspec
@@ -326,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
335
  version: 1.3.1
327
336
  requirements: []
328
337
  rubyforge_project:
329
- rubygems_version: 2.6.14
338
+ rubygems_version: 2.7.9
330
339
  signing_key:
331
340
  specification_version: 4
332
341
  summary: The next generation developer focused tool for automated testing of webapps
@@ -1,110 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Licensed to the Software Freedom Conservancy (SFC) under one
4
- # or more contributor license agreements. See the NOTICE file
5
- # distributed with this work for additional information
6
- # regarding copyright ownership. The SFC licenses this file
7
- # to you under the Apache License, Version 2.0 (the
8
- # "License"); you may not use this file except in compliance
9
- # with the License. You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing,
14
- # software distributed under the License is distributed on an
15
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- # KIND, either express or implied. See the License for the
17
- # specific language governing permissions and limitations
18
- # under the License.
19
-
20
- module Selenium
21
- module WebDriver
22
- module Firefox
23
- # @api private
24
- class Binary
25
- class << self
26
- #
27
- # @api private
28
- #
29
- # @see Firefox.path=
30
- #
31
-
32
- def path=(path)
33
- Platform.assert_executable(path)
34
- @path = path
35
- end
36
-
37
- def reset_path!
38
- @path = nil
39
- end
40
-
41
- def path
42
- @path ||= case Platform.os
43
- when :macosx
44
- macosx_path
45
- when :windows
46
- windows_path
47
- when :linux, :unix
48
- Platform.find_binary('firefox3', 'firefox2', 'firefox') || '/usr/bin/firefox'
49
- else
50
- raise Error::WebDriverError, "unknown platform: #{Platform.os}"
51
- end
52
-
53
- @path = Platform.cygwin_path(@path, windows: true) if Platform.cygwin?
54
-
55
- unless File.file?(@path.to_s)
56
- error = "Could not find Firefox binary (os=#{Platform.os}). " \
57
- "Make sure Firefox is installed or set the path manually with #{self}.path="
58
- raise Error::WebDriverError, error
59
- end
60
-
61
- @path
62
- end
63
-
64
- def version
65
- @version = case Platform.os
66
- when :macosx
67
- `#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
68
- when :windows
69
- `\"#{path}\" -v | more`.strip[/[^\s]*$/][/^\d+/].to_i
70
- when :linux
71
- `#{path} -v`.strip[/[^\s]*$/][/^\d+/].to_i
72
- else
73
- 0
74
- end
75
- end
76
-
77
- private
78
-
79
- def windows_path
80
- windows_registry_path ||
81
- Platform.find_in_program_files('\\Mozilla Firefox\\firefox.exe') ||
82
- Platform.find_binary('firefox')
83
- end
84
-
85
- def macosx_path
86
- path = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
87
- path = File.expand_path('~/Applications/Firefox.app/Contents/MacOS/firefox-bin') unless File.exist?(path)
88
- path = Platform.find_binary('firefox-bin') unless File.exist?(path)
89
-
90
- path
91
- end
92
-
93
- def windows_registry_path
94
- require 'win32/registry'
95
-
96
- lm = Win32::Registry::HKEY_LOCAL_MACHINE
97
- lm.open('SOFTWARE\\Mozilla\\Mozilla Firefox') do |reg|
98
- main = lm.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{reg.keys[0]}\\Main")
99
- entry = main.find { |key, _type, _data| /pathtoexe/i.match? key }
100
- return entry.last if entry
101
- end
102
- rescue LoadError
103
- # older JRuby or IronRuby does not have win32/registry
104
- rescue Win32::Registry::Error
105
- end
106
- end # class << self
107
- end # Binary
108
- end # Firefox
109
- end # WebDriver
110
- end # Selenium
@@ -1,69 +0,0 @@
1
- {
2
- "frozen": {
3
- "app.update.auto": false,
4
- "app.update.enabled": false,
5
- "browser.displayedE10SNotice": 4,
6
- "browser.download.manager.showWhenStarting": false,
7
- "browser.EULA.override": true,
8
- "browser.EULA.3.accepted": true,
9
- "browser.link.open_external": 2,
10
- "browser.link.open_newwindow": 2,
11
- "browser.offline": false,
12
- "browser.reader.detectedFirstArticle": true,
13
- "browser.safebrowsing.enabled": false,
14
- "browser.safebrowsing.malware.enabled": false,
15
- "browser.search.update": false,
16
- "browser.selfsupport.url" : "",
17
- "browser.sessionstore.resume_from_crash": false,
18
- "browser.shell.checkDefaultBrowser": false,
19
- "browser.tabs.warnOnClose": false,
20
- "browser.tabs.warnOnOpen": false,
21
- "datareporting.healthreport.service.enabled": false,
22
- "datareporting.healthreport.uploadEnabled": false,
23
- "datareporting.healthreport.service.firstRun": false,
24
- "datareporting.healthreport.logging.consoleEnabled": false,
25
- "datareporting.policy.dataSubmissionEnabled": false,
26
- "datareporting.policy.dataSubmissionPolicyAccepted": false,
27
- "devtools.errorconsole.enabled": true,
28
- "dom.disable_open_during_load": false,
29
- "extensions.autoDisableScopes": 10,
30
- "extensions.blocklist.enabled": false,
31
- "extensions.checkCompatibility.nightly": false,
32
- "extensions.update.enabled": false,
33
- "extensions.update.notifyUser": false,
34
- "javascript.enabled": true,
35
- "network.manage-offline-status": false,
36
- "network.http.phishy-userpass-length": 255,
37
- "offline-apps.allow_by_default": true,
38
- "prompts.tab_modal.enabled": false,
39
- "security.fileuri.origin_policy": 3,
40
- "security.fileuri.strict_origin_policy": false,
41
- "signon.rememberSignons": false,
42
- "toolkit.networkmanager.disable": true,
43
- "toolkit.telemetry.prompted": 2,
44
- "toolkit.telemetry.enabled": false,
45
- "toolkit.telemetry.rejected": true,
46
- "xpinstall.signatures.required": false,
47
- "xpinstall.whitelist.required": false
48
- },
49
- "mutable": {
50
- "browser.dom.window.dump.enabled": true,
51
- "browser.laterrun.enabled": false,
52
- "browser.newtab.url": "about:blank",
53
- "browser.newtabpage.enabled": false,
54
- "browser.startup.page": 0,
55
- "browser.startup.homepage": "about:blank",
56
- "browser.startup.homepage_override.mstone": "ignore",
57
- "browser.usedOnWindows10.introURL": "about:blank",
58
- "dom.max_chrome_script_run_time": 30,
59
- "dom.max_script_run_time": 30,
60
- "dom.report_all_js_exceptions": true,
61
- "javascript.options.showInConsole": true,
62
- "network.captive-portal-service.enabled": false,
63
- "security.csp.enable": false,
64
- "startup.homepage_welcome_url": "about:blank",
65
- "startup.homepage_welcome_url.additional": "about:blank",
66
- "webdriver_accept_untrusted_certs": true,
67
- "webdriver_assume_untrusted_issuer": true
68
- }
69
- }