selenium-webdriver 4.0.0.alpha2 → 4.0.0.alpha3

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 (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +38 -0
  3. data/lib/selenium/server.rb +2 -2
  4. data/lib/selenium/webdriver.rb +9 -7
  5. data/lib/selenium/webdriver/chrome.rb +6 -7
  6. data/lib/selenium/webdriver/chrome/bridge.rb +21 -3
  7. data/lib/selenium/webdriver/chrome/driver.rb +3 -41
  8. data/lib/selenium/webdriver/chrome/options.rb +87 -52
  9. data/lib/selenium/webdriver/chrome/profile.rb +2 -2
  10. data/lib/selenium/webdriver/common.rb +1 -0
  11. data/lib/selenium/webdriver/common/driver.rb +7 -0
  12. data/lib/selenium/webdriver/common/options.rb +92 -0
  13. data/lib/selenium/webdriver/common/profile_helper.rb +10 -2
  14. data/lib/selenium/webdriver/common/service.rb +35 -11
  15. data/lib/selenium/webdriver/edge.rb +25 -7
  16. data/lib/selenium/webdriver/edge_chrome/bridge.rb +30 -0
  17. data/lib/selenium/webdriver/edge_chrome/driver.rb +38 -0
  18. data/lib/selenium/webdriver/edge_chrome/options.rb +34 -0
  19. data/lib/selenium/webdriver/edge_chrome/profile.rb +33 -0
  20. data/lib/selenium/webdriver/edge_chrome/service.rb +40 -0
  21. data/lib/selenium/webdriver/{edge → edge_html}/driver.rb +2 -19
  22. data/lib/selenium/webdriver/{edge → edge_html}/options.rb +26 -15
  23. data/lib/selenium/webdriver/{edge → edge_html}/service.rb +1 -1
  24. data/lib/selenium/webdriver/firefox.rb +9 -12
  25. data/lib/selenium/webdriver/firefox/binary.rb +2 -2
  26. data/lib/selenium/webdriver/firefox/driver.rb +3 -19
  27. data/lib/selenium/webdriver/firefox/extension.rb +8 -0
  28. data/lib/selenium/webdriver/firefox/options.rb +45 -48
  29. data/lib/selenium/webdriver/firefox/profile.rb +5 -3
  30. data/lib/selenium/webdriver/ie.rb +4 -5
  31. data/lib/selenium/webdriver/ie/driver.rb +3 -20
  32. data/lib/selenium/webdriver/ie/options.rb +9 -29
  33. data/lib/selenium/webdriver/remote.rb +16 -10
  34. data/lib/selenium/webdriver/remote/capabilities.rb +10 -0
  35. data/lib/selenium/webdriver/remote/http/default.rb +6 -1
  36. data/lib/selenium/webdriver/remote/http/persistent.rb +5 -6
  37. data/lib/selenium/webdriver/safari.rb +5 -6
  38. data/lib/selenium/webdriver/safari/bridge.rb +3 -3
  39. data/lib/selenium/webdriver/safari/driver.rb +4 -18
  40. data/lib/selenium/webdriver/safari/options.rb +18 -12
  41. data/lib/selenium/webdriver/version.rb +1 -1
  42. metadata +11 -5
@@ -20,7 +20,7 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module IE
23
- class Options
23
+ class Options < WebDriver::Options
24
24
  KEY = 'se:ieOptions'
25
25
  SCROLL_TOP = 0
26
26
  SCROLL_BOTTOM = 1
@@ -52,7 +52,7 @@ module Selenium
52
52
  end
53
53
  end
54
54
 
55
- attr_reader :args, :options
55
+ attr_reader :args
56
56
 
57
57
  #
58
58
  # Create a new Options instance
@@ -85,9 +85,10 @@ module Selenium
85
85
  # @option opts [Boolean] validate_cookie_document_type
86
86
  #
87
87
 
88
- def initialize(**opts)
89
- @args = Set.new(opts.delete(:args) || [])
90
- @options = opts
88
+ def initialize(args: nil, **opts)
89
+ super(opts)
90
+
91
+ @args = (args || []).to_set
91
92
  @options[:native_events] = true if @options[:native_events].nil?
92
93
  end
93
94
 
@@ -101,36 +102,15 @@ module Selenium
101
102
  @args << arg
102
103
  end
103
104
 
104
- #
105
- # Add a new option not yet handled by these bindings.
106
- #
107
- # @example
108
- # options = Selenium::WebDriver::IE::Options.new
109
- # options.add_option(:foo, 'bar')
110
- #
111
- # @param [String, Symbol] name Name of the option
112
- # @param [Boolean, String, Integer] value Value of the option
113
- #
114
-
115
- def add_option(name, value)
116
- @options[name] = value
117
- end
118
-
119
105
  #
120
106
  # @api private
121
107
  #
122
108
 
123
109
  def as_json(*)
124
- opts = {}
125
-
126
- CAPABILITIES.each do |capability_alias, capability_name|
127
- capability_value = @options.delete(capability_alias)
128
- opts[capability_name] = capability_value unless capability_value.nil?
129
- end
130
- opts['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
131
- opts.merge!(@options)
110
+ options = super
111
+ options['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
132
112
 
133
- {KEY => opts}
113
+ {KEY => generate_as_json(options)}
134
114
  end
135
115
  end # Options
136
116
  end # IE
@@ -19,13 +19,19 @@
19
19
 
20
20
  require 'uri'
21
21
 
22
- require 'selenium/webdriver/remote/bridge'
23
- require 'selenium/webdriver/remote/driver'
24
- require 'selenium/webdriver/remote/response'
25
- require 'selenium/webdriver/remote/server_error'
26
- require 'selenium/webdriver/remote/http/common'
27
- require 'selenium/webdriver/remote/http/default'
28
-
29
- require 'selenium/webdriver/remote/bridge'
30
- require 'selenium/webdriver/remote/capabilities'
31
- require 'selenium/webdriver/remote/commands'
22
+ module Selenium
23
+ module WebDriver
24
+ module Remote
25
+ autoload :Bridge, 'selenium/webdriver/remote/bridge'
26
+ autoload :Driver, 'selenium/webdriver/remote/driver'
27
+ autoload :Response, 'selenium/webdriver/remote/response'
28
+ autoload :ServerError, 'selenium/webdriver/remote/server_error'
29
+ autoload :Capabilities, 'selenium/webdriver/remote/capabilities'
30
+ autoload :COMMANDS, 'selenium/webdriver/remote/commands'
31
+ module Http
32
+ autoload :Common, 'selenium/webdriver/remote/http/common'
33
+ autoload :Default, 'selenium/webdriver/remote/http/default'
34
+ end
35
+ end
36
+ end
37
+ end
@@ -82,12 +82,22 @@ module Selenium
82
82
  end
83
83
 
84
84
  def edge(opts = {})
85
+ edge_html(opts)
86
+ end
87
+
88
+ def edge_html(opts = {})
85
89
  new({
86
90
  browser_name: 'MicrosoftEdge',
87
91
  platform_name: :windows
88
92
  }.merge(opts))
89
93
  end
90
94
 
95
+ def edge_chrome(opts = {})
96
+ new({
97
+ browser_name: 'MicrosoftEdge'
98
+ }.merge(opts))
99
+ end
100
+
91
101
  def firefox(opts = {})
92
102
  opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
93
103
  opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
@@ -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)
@@ -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"
@@ -61,5 +62,3 @@ module Selenium
61
62
  end # Safari
62
63
  end # WebDriver
63
64
  end # Selenium
64
-
65
- require 'selenium/webdriver/safari/service'
@@ -24,9 +24,9 @@ module Selenium
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,19 +29,21 @@ 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
35
  def initialize(opts = {})
35
- opts[:desired_capabilities] = create_capabilities(opts)
36
+ opts[:desired_capabilities] ||= Remote::Capabilities.safari
36
37
 
37
38
  opts[:url] ||= service_url(opts)
38
39
 
39
40
  listener = opts.delete(:listener)
40
41
  desired_capabilities = opts.delete(:desired_capabilities)
42
+ options = opts.delete(:options)
41
43
 
42
44
  @bridge = Remote::Bridge.new(opts)
43
45
  @bridge.extend Bridge
44
- @bridge.create_session(desired_capabilities)
46
+ @bridge.create_session(desired_capabilities, options)
45
47
 
46
48
  super(@bridge, listener: listener)
47
49
  end
@@ -49,22 +51,6 @@ module Selenium
49
51
  def browser
50
52
  :safari
51
53
  end
52
-
53
- def quit
54
- super
55
- ensure
56
- @service&.stop
57
- 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
54
  end # Driver
69
55
  end # Safari
70
56
  end # WebDriver
@@ -20,8 +20,22 @@
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
+
30
+ CAPABILITIES.each_key do |key|
31
+ define_method key do
32
+ @options[key]
33
+ end
34
+
35
+ define_method "#{key}=" do |value|
36
+ @options[key] = value
37
+ end
38
+ end
25
39
 
26
40
  #
27
41
  # Create a new Options instance for W3C-capable versions of Safari.
@@ -34,12 +48,9 @@ module Selenium
34
48
  # @option opts [Boolean] :automatic_inspection Preloads Web Inspector and JavaScript debugger. Default is false
35
49
  # @option opts [Boolean] :automatic_profiling Preloads Web Inspector and starts a timeline recording. Default is false
36
50
  #
37
- # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
38
- #
39
51
 
40
52
  def initialize(**opts)
41
- @automatic_inspection = opts.delete(:automatic_inspection) || false
42
- @automatic_profiling = opts.delete(:automatic_profiling) || false
53
+ super
43
54
  end
44
55
 
45
56
  #
@@ -47,12 +58,7 @@ module Selenium
47
58
  #
48
59
 
49
60
  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
61
+ generate_as_json(super)
56
62
  end
57
63
  end # Options
58
64
  end # Safari
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '4.0.0.alpha2'
22
+ VERSION = '4.0.0.alpha3'
23
23
  end # WebDriver
24
24
  end # Selenium
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.alpha2
4
+ version: 4.0.0.alpha3
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-02 00:00:00.000000000 Z
13
+ date: 2019-07-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +242,7 @@ files:
242
242
  - lib/selenium/webdriver/common/logs.rb
243
243
  - lib/selenium/webdriver/common/manager.rb
244
244
  - lib/selenium/webdriver/common/navigation.rb
245
+ - lib/selenium/webdriver/common/options.rb
245
246
  - lib/selenium/webdriver/common/platform.rb
246
247
  - lib/selenium/webdriver/common/port_prober.rb
247
248
  - lib/selenium/webdriver/common/profile_helper.rb
@@ -256,9 +257,14 @@ files:
256
257
  - lib/selenium/webdriver/common/window.rb
257
258
  - lib/selenium/webdriver/common/zipper.rb
258
259
  - lib/selenium/webdriver/edge.rb
259
- - lib/selenium/webdriver/edge/driver.rb
260
- - lib/selenium/webdriver/edge/options.rb
261
- - lib/selenium/webdriver/edge/service.rb
260
+ - lib/selenium/webdriver/edge_chrome/bridge.rb
261
+ - lib/selenium/webdriver/edge_chrome/driver.rb
262
+ - lib/selenium/webdriver/edge_chrome/options.rb
263
+ - lib/selenium/webdriver/edge_chrome/profile.rb
264
+ - lib/selenium/webdriver/edge_chrome/service.rb
265
+ - lib/selenium/webdriver/edge_html/driver.rb
266
+ - lib/selenium/webdriver/edge_html/options.rb
267
+ - lib/selenium/webdriver/edge_html/service.rb
262
268
  - lib/selenium/webdriver/firefox.rb
263
269
  - lib/selenium/webdriver/firefox/binary.rb
264
270
  - lib/selenium/webdriver/firefox/bridge.rb