selenium-webdriver 3.14.1 → 3.141.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc2fa60c4b4dcb28481e549ef426d29ae729aca8
4
- data.tar.gz: a284aba391e1e3ad1ce0b77aed8e5beba4f82465
3
+ metadata.gz: 66ea2f3150d90a9226b8071c0f3d7f68a1286de0
4
+ data.tar.gz: 4b52f675b096ccb1f99ece3b84bbea29dd41906f
5
5
  SHA512:
6
- metadata.gz: fb9dfe880130c48329c5defaae8fefa37dded984ae790937f2336c399b488c2d0d24fc82acd6871e3bf46a28163cc61e3d2d5dc43dab8a657841c9a0a1b1a24d
7
- data.tar.gz: 18ee7fdb743fa5805d4f7c8778f9fe490713f89e3319da60e88b62e4d561bd6aa563b4b31e3f6b724cd69faebf61c8eb92d637d1b6125bd5ccc8ee5dec0cb24d
6
+ metadata.gz: 267dce8aada9928450f1c59ee442b40ab3c6551155cc9127c635ae5abb641d272c1d32855f654f903b6dcb866ecf60c5608aa3c7e8f7027e928e71e609425753
7
+ data.tar.gz: f8fe782853b7bf314ac2c24bdb33bd3fecdd8001a603b8a448b08c296d195a9b791da4ffcb9b92454617a8d668cf0a1eb7ad191cf055363074897857831c791c
data/CHANGES CHANGED
@@ -1,3 +1,29 @@
1
+ 3.141.0 (2018-10-31)
2
+ ====================
3
+
4
+ Edge:
5
+ * Added new Edge::Options class that should be used to customize browser
6
+ behavior. The instance of options class can be passed to driver
7
+ initialization using :options key. Please, note that using options require
8
+ insiders builds of Edge.
9
+
10
+ Chrome:
11
+ * Included HasLocation to Chrome driver (thanks @sidonath).
12
+ * Updated endpoint to send Chrome Debugging Protocol commands. The old one
13
+ has been deprecated in ChromeDriver 40.
14
+
15
+ Safari:
16
+ * Added new Safari::Options class that should be used to customize browser
17
+ behavior. The instance of options class can be passed to driver
18
+ initialization using :options key. Please, note that using options require
19
+ Safari 12+.
20
+
21
+ Remote:
22
+ * Allow passing Options instances to remote driver initialization using
23
+ :options key. This feature allows to use browser-specific options classes
24
+ (Chrome::Options, Firefox::Options, etc.) and pass them to Server/Grid
25
+ instead of capabilities.
26
+
1
27
  3.14.1 (2018-10-03)
2
28
  ===================
3
29
 
@@ -199,7 +199,7 @@ module Selenium
199
199
  stop_process if @process
200
200
  poll_for_shutdown
201
201
 
202
- @log_file.close if @log_file
202
+ @log_file.close if defined?(@log_file)
203
203
  end
204
204
 
205
205
  def webdriver_url
@@ -23,7 +23,7 @@ module Selenium
23
23
  COMMANDS = {
24
24
  get_network_conditions: [:get, '/session/:session_id/chromium/network_conditions'.freeze],
25
25
  set_network_conditions: [:post, '/session/:session_id/chromium/network_conditions'.freeze],
26
- send_command: [:post, '/session/:session_id/chromium/send_command'.freeze]
26
+ send_command: [:post, '/session/:session_id/goog/cdp/execute'.freeze]
27
27
  }.freeze
28
28
 
29
29
  def commands(command)
@@ -28,6 +28,7 @@ module Selenium
28
28
  include DriverExtensions::HasNetworkConditions
29
29
  include DriverExtensions::HasTouchScreen
30
30
  include DriverExtensions::HasWebStorage
31
+ include DriverExtensions::HasLocation
31
32
  include DriverExtensions::TakesScreenshot
32
33
  include DriverExtensions::DownloadsFiles
33
34
 
@@ -19,6 +19,7 @@ require 'net/http'
19
19
 
20
20
  require 'selenium/webdriver/edge/bridge'
21
21
  require 'selenium/webdriver/edge/driver'
22
+ require 'selenium/webdriver/edge/options'
22
23
  require 'selenium/webdriver/edge/service'
23
24
 
24
25
  module Selenium
@@ -0,0 +1,77 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Selenium
19
+ module WebDriver
20
+ module Edge
21
+ class Options
22
+ attr_accessor :in_private, :start_page
23
+ attr_reader :extension_paths
24
+
25
+ #
26
+ # Create a new Options instance for Edge.
27
+ #
28
+ # @example
29
+ # options = Selenium::WebDriver::Edge::Options.new(in_private: true)
30
+ # driver = Selenium::WebDriver.for :edge, options: options
31
+ #
32
+ # @param [Hash] opts the pre-defined options to create the Edge::Options with
33
+ # @option opts [Boolean] :in_private Start in private mode. Default is false
34
+ # @option opts [Array<String>] :extension_paths A list of full paths to extensions to install on startup
35
+ # @option opts [String] :start_page Default page to start with
36
+ #
37
+ # @see https://docs.microsoft.com/en-us/microsoft-edge/webdriver
38
+ #
39
+
40
+ def initialize(**opts)
41
+ @in_private = opts.delete(:in_private) || false
42
+ @extension_paths = opts.delete(:extension_paths) || []
43
+ @start_page = opts.delete(:start_page)
44
+ end
45
+
46
+ #
47
+ # Add an extension by local path.
48
+ #
49
+ # @example
50
+ # options = Selenium::WebDriver::Edge::Options.new
51
+ # options.add_extension_path('C:\path\to\extension')
52
+ #
53
+ # @param [String] path The local path to the extension folder
54
+ #
55
+
56
+ def add_extension_path(path)
57
+ raise Error::WebDriverError, "could not find extension at #{path.inspect}" unless File.directory?(path)
58
+ @extension_paths << path
59
+ end
60
+
61
+ #
62
+ # @api private
63
+ #
64
+
65
+ def as_json(*)
66
+ opts = {}
67
+
68
+ opts['ms:inPrivate'] = true if @in_private
69
+ opts['ms:extensionPaths'] = @extension_paths if @extension_paths.any?
70
+ opts['ms:startPage'] = @start_page if @start_page
71
+
72
+ opts
73
+ end
74
+ end # Options
75
+ end # Edge
76
+ end # WebDriver
77
+ end # Selenium
@@ -50,7 +50,7 @@ module Selenium
50
50
  end
51
51
 
52
52
  bridge = new(opts)
53
- capabilities = bridge.create_session(desired_capabilities)
53
+ capabilities = bridge.create_session(desired_capabilities, opts.delete(:options))
54
54
 
55
55
  case bridge.dialect
56
56
  when :oss
@@ -73,8 +73,10 @@ module Selenium
73
73
 
74
74
  def initialize(opts = {})
75
75
  opts = opts.dup
76
+
76
77
  http_client = opts.delete(:http_client) { Http::Default.new }
77
78
  url = opts.delete(:url) { "http://#{Platform.localhost}:#{PORT}/wd/hub" }
79
+ opts.delete(:options)
78
80
 
79
81
  unless opts.empty?
80
82
  raise ArgumentError, "unknown option#{'s' if opts.size != 1}: #{opts.inspect}"
@@ -93,8 +95,8 @@ module Selenium
93
95
  # Creates session handling both OSS and W3C dialects.
94
96
  #
95
97
 
96
- def create_session(desired_capabilities)
97
- response = execute(:new_session, {}, merged_capabilities(desired_capabilities))
98
+ def create_session(desired_capabilities, options = nil)
99
+ response = execute(:new_session, {}, merged_capabilities(desired_capabilities, options))
98
100
 
99
101
  @session_id = response['sessionId']
100
102
  oss_status = response['status']
@@ -173,8 +175,9 @@ module Selenium
173
175
  COMMANDS[command]
174
176
  end
175
177
 
176
- def merged_capabilities(oss_capabilities)
178
+ def merged_capabilities(oss_capabilities, options = nil)
177
179
  w3c_capabilities = W3C::Capabilities.from_oss(oss_capabilities)
180
+ w3c_capabilities.merge!(options.as_json) if options
178
181
 
179
182
  {
180
183
  desiredCapabilities: oss_capabilities,
@@ -17,6 +17,7 @@
17
17
 
18
18
  require 'selenium/webdriver/safari/bridge'
19
19
  require 'selenium/webdriver/safari/driver'
20
+ require 'selenium/webdriver/safari/options'
20
21
  require 'selenium/webdriver/safari/service'
21
22
 
22
23
  module Selenium
@@ -30,7 +30,7 @@ module Selenium
30
30
  include DriverExtensions::TakesScreenshot
31
31
 
32
32
  def initialize(opts = {})
33
- opts[:desired_capabilities] ||= Remote::Capabilities.safari
33
+ opts[:desired_capabilities] = create_capabilities(opts)
34
34
 
35
35
  unless opts.key?(:url)
36
36
  driver_path = opts.delete(:driver_path) || Safari.driver_path
@@ -55,6 +55,15 @@ module Selenium
55
55
  @service.stop if @service
56
56
  end
57
57
 
58
+ private
59
+
60
+ def create_capabilities(opts = {})
61
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.safari }
62
+ options = opts.delete(:options) { Options.new }
63
+ caps.merge!(options.as_json)
64
+ caps
65
+ end
66
+
58
67
  end # Driver
59
68
  end # Safari
60
69
  end # WebDriver
@@ -0,0 +1,58 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ module Selenium
19
+ module WebDriver
20
+ module Safari
21
+ class Options
22
+ attr_accessor :automatic_inspection, :automatic_profiling
23
+
24
+ #
25
+ # Create a new Options instance for W3C-capable versions of Safari.
26
+ #
27
+ # @example
28
+ # options = Selenium::WebDriver::Safari::Options.new(automatic_inspection: true)
29
+ # driver = Selenium::WebDriver.for :safari, options: options
30
+ #
31
+ # @param [Hash] opts the pre-defined options to create the Safari::Options with
32
+ # @option opts [Boolean] :automatic_inspection Preloads Web Inspector and JavaScript debugger. Default is false
33
+ # @option opts [Boolean] :automatic_profiling Preloads Web Inspector and starts a timeline recording. Default is false
34
+ #
35
+ # @see https://developer.apple.com/documentation/webkit/about_webdriver_for_safari
36
+ #
37
+
38
+ def initialize(**opts)
39
+ @automatic_inspection = opts.delete(:automatic_inspection) || false
40
+ @automatic_profiling = opts.delete(:automatic_profiling) || false
41
+ end
42
+
43
+ #
44
+ # @api private
45
+ #
46
+
47
+ def as_json(*)
48
+ opts = {}
49
+
50
+ opts['safari:automaticInspection'] = true if @automatic_inspection
51
+ opts['safari:automaticProfiling'] = true if @automatic_profiling
52
+
53
+ opts
54
+ end
55
+ end # Options
56
+ end # Safari
57
+ end # WebDriver
58
+ end # Selenium
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Selenium
19
19
  module WebDriver
20
- VERSION = '3.14.1'.freeze
20
+ VERSION = '3.141.0'.freeze
21
21
  end # WebDriver
22
22
  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: 3.14.1
4
+ version: 3.141.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-10-04 00:00:00.000000000 Z
12
+ date: 2018-11-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +202,7 @@ files:
202
202
  - lib/selenium/webdriver/edge.rb
203
203
  - lib/selenium/webdriver/edge/bridge.rb
204
204
  - lib/selenium/webdriver/edge/driver.rb
205
+ - lib/selenium/webdriver/edge/options.rb
205
206
  - lib/selenium/webdriver/edge/service.rb
206
207
  - lib/selenium/webdriver/firefox.rb
207
208
  - lib/selenium/webdriver/firefox/binary.rb
@@ -242,6 +243,7 @@ files:
242
243
  - lib/selenium/webdriver/safari.rb
243
244
  - lib/selenium/webdriver/safari/bridge.rb
244
245
  - lib/selenium/webdriver/safari/driver.rb
246
+ - lib/selenium/webdriver/safari/options.rb
245
247
  - lib/selenium/webdriver/safari/service.rb
246
248
  - lib/selenium/webdriver/support.rb
247
249
  - lib/selenium/webdriver/support/abstract_event_listener.rb