selenium-webdriver 3.142.6 → 3.142.7

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: 5c1b3f97015a3b8008f3b29bfd6bad97ba2f065c
4
- data.tar.gz: 138f7b9090ceb5dbae76174d7e5778edd35a8abe
3
+ metadata.gz: c9f40e154da198fff9e277f0613042c22fff6c98
4
+ data.tar.gz: 33cc734e78b08e66c00a4c73f51c635d97c86fe6
5
5
  SHA512:
6
- metadata.gz: d37493473105357942a2e73dd137b5dd13d747a85982217f4296110c961a0b6197a194084766de856d08bb78f2608ac66043b4220c4a1b0673fb75c7cb9f0f38
7
- data.tar.gz: d61d39b2060c5da80669c72e21e65ef8f6d4c052967289cded7f84ff7f70bd6817da268496909f17abb0e5ddc04c0be55c25a45f0de2e7480dc9fcd3e77b1581
6
+ metadata.gz: b40eb2e74a284b21ee31924f7cf20b878c7ab6ebcfe7848b21ad163165c80467c9d3a6fa6252ca74680b82db7186e8c1b73a2ac5f4d37501b0dfa16763ec19b9
7
+ data.tar.gz: bc9e9e0128888f3efe33f59160b677cc88655bf986877c534053adf915f3b39a78ff1d88e9b2d80753c1aba49af92f1796bb4f774ca68114027594813cc26ad3
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ 3.142.7 (2019-12-27)
2
+ ====================
3
+
4
+ Ruby:
5
+ * Fix keyword argument deprecations in Ruby 2.7 (thanks @connorshea)
6
+
1
7
  3.142.6 (2019-10-04)
2
8
  ====================
3
9
 
@@ -40,7 +40,7 @@ module Selenium
40
40
  opts[:url] ||= service_url(opts)
41
41
 
42
42
  listener = opts.delete(:listener)
43
- @bridge = Remote::Bridge.handshake(opts)
43
+ @bridge = Remote::Bridge.handshake(**opts)
44
44
  @bridge.extend Bridge
45
45
 
46
46
  super(@bridge, listener: listener)
@@ -76,21 +76,29 @@ module Selenium
76
76
 
77
77
  profile = opts.delete(:profile)
78
78
  if profile
79
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome::Driver#new with `:profile` parameter',
80
+ 'Selenium::WebDriver::Chrome::Options#profile or Options#add_option'
81
+
79
82
  profile = profile.as_json
80
83
 
81
- options.add_argument("--user-data-dir=#{profile[:directory]}") if options.args.none? { |arg| arg =~ /user-data-dir/ }
84
+ if options.args.none?(&/user-data-dir/.method(:match?))
85
+ options.add_argument("--user-data-dir=#{profile['directory']}")
86
+ end
82
87
 
83
- if profile[:extensions]
84
- WebDriver.logger.deprecate 'Using Selenium::WebDriver::Chrome::Profile#extensions',
88
+ if profile['extensions']
89
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome::Profile#extensions',
85
90
  'Selenium::WebDriver::Chrome::Options#add_extension'
86
- profile[:extensions].each do |extension|
91
+ profile['extensions'].each do |extension|
87
92
  options.add_encoded_extension(extension)
88
93
  end
89
94
  end
90
95
  end
91
96
 
92
- detach = opts.delete(:detach)
93
- options.add_option(:detach, true) if detach
97
+ if opts.key?(:detach)
98
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome::Driver#new with `:detach` parameter',
99
+ 'Selenium::WebDriver::Chrome::Options#new or Options#add_option'
100
+ options.add_option(:detach, opts.delete(:detach))
101
+ end
94
102
 
95
103
  prefs = opts.delete(:prefs)
96
104
  if prefs
@@ -103,8 +111,13 @@ module Selenium
103
111
  options = options.as_json
104
112
  caps.merge!(options) unless options[Options::KEY].empty?
105
113
 
106
- caps[:proxy] = opts.delete(:proxy) if opts.key?(:proxy)
107
- caps[:proxy] ||= opts.delete('proxy') if opts.key?('proxy')
114
+ if opts.key?(:proxy) || opts.key?('proxy')
115
+ WebDriver.logger.deprecate 'Selenium::WebDriver::Chrome::Driver#new with `:proxy` parameter',
116
+ 'Selenium::WebDriver::Chrome::Capabilities#proxy='
117
+
118
+ caps[:proxy] = opts.delete(:proxy) if opts.key?(:proxy)
119
+ caps[:proxy] ||= opts.delete('proxy') if opts.key?('proxy')
120
+ end
108
121
 
109
122
  caps
110
123
  end
@@ -20,9 +20,9 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Chrome
23
- class Options
23
+ class Options < WebDriver::Common::Options
24
24
  attr_reader :args, :prefs, :options, :emulation, :extensions, :encoded_extensions
25
- attr_accessor :binary
25
+ attr_accessor :binary, :profile, :detach
26
26
 
27
27
  KEY = 'goog:chromeOptions'
28
28
 
@@ -49,6 +49,8 @@ module Selenium
49
49
  @extensions = opts.delete(:extensions) || []
50
50
  @options = opts.delete(:options) || {}
51
51
  @emulation = opts.delete(:emulation) || {}
52
+ @detach = opts.delete(:detach)
53
+ @profile = opts.delete(:profile)
52
54
  @encoded_extensions = []
53
55
  end
54
56
 
@@ -170,6 +172,7 @@ module Selenium
170
172
  File.open(crx_path, 'rb') { |crx_file| Base64.strict_encode64 crx_file.read }
171
173
  end
172
174
  extensions.concat(@encoded_extensions)
175
+ add_argument("--user-data-dir=#{@profile[:directory]}") if @profile
173
176
 
174
177
  opts = @options
175
178
  opts[:binary] = @binary if @binary
@@ -177,8 +180,9 @@ module Selenium
177
180
  opts[:extensions] = extensions if extensions.any?
178
181
  opts[:mobileEmulation] = @emulation unless @emulation.empty?
179
182
  opts[:prefs] = @prefs unless @prefs.empty?
183
+ opts[:detach] = @detach if !@detach.nil? && @detach != false
180
184
 
181
- {KEY => opts}
185
+ {KEY => generate_as_json(opts)}
182
186
  end
183
187
  end # Options
184
188
  end # Chrome
@@ -77,8 +77,8 @@ module Selenium
77
77
 
78
78
  extensions.concat(@encoded_extensions)
79
79
 
80
- opts = {directory: directory || layout_on_disk}
81
- opts[:extensions] = extensions if extensions.any?
80
+ opts = {'directory' => directory || layout_on_disk}
81
+ opts['extensions'] = extensions if extensions.any?
82
82
  opts
83
83
  end
84
84
 
@@ -72,5 +72,6 @@ require 'selenium/webdriver/common/interactions/pointer_input'
72
72
  require 'selenium/webdriver/common/keys'
73
73
  require 'selenium/webdriver/common/bridge_helper'
74
74
  require 'selenium/webdriver/common/profile_helper'
75
+ require 'selenium/webdriver/common/options'
75
76
  require 'selenium/webdriver/common/driver'
76
77
  require 'selenium/webdriver/common/element'
@@ -0,0 +1,53 @@
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 Common
23
+ class Options
24
+ private
25
+
26
+ def generate_as_json(value)
27
+ if value.respond_to?(:as_json)
28
+ value.as_json
29
+ elsif value.is_a?(Hash)
30
+ value.each_with_object({}) { |(key, val), hash| hash[convert_json_key(key)] = generate_as_json(val) }
31
+ elsif value.is_a?(Array)
32
+ value.map(&method(:generate_as_json))
33
+ elsif value.is_a?(Symbol)
34
+ value.to_s
35
+ else
36
+ value
37
+ end
38
+ end
39
+
40
+ def convert_json_key(key)
41
+ key = camel_case(key) if key.is_a?(Symbol)
42
+ return key if key.is_a?(String)
43
+
44
+ raise TypeError, "expected String or Symbol, got #{key.inspect}:#{key.class}"
45
+ end
46
+
47
+ def camel_case(str)
48
+ str.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
49
+ end
50
+ end # Options
51
+ end # Common
52
+ end # WebDriver
53
+ end # Selenium
@@ -44,7 +44,7 @@ module Selenium
44
44
  capabilities = bridge.create_session(desired_capabilities)
45
45
 
46
46
  WebDriver.logger.info 'Forcing W3C dialect.'
47
- @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
47
+ @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
48
48
  @bridge.extend Edge::Bridge
49
49
 
50
50
  super(@bridge, listener: listener)
@@ -42,7 +42,7 @@ module Selenium
42
42
  desired_capabilities = opts.delete(:desired_capabilities)
43
43
  bridge = Remote::Bridge.new(opts)
44
44
  capabilities = bridge.create_session(desired_capabilities)
45
- @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
45
+ @bridge = Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
46
46
  @bridge.extend Marionette::Bridge
47
47
 
48
48
  super(@bridge, listener: listener)
@@ -20,7 +20,7 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module Firefox
23
- class Options
23
+ class Options < WebDriver::Common::Options
24
24
  attr_reader :args, :prefs, :options, :profile
25
25
  attr_accessor :binary, :log_level
26
26
 
@@ -139,7 +139,7 @@ module Selenium
139
139
  opts[:prefs] = @prefs unless @prefs.empty?
140
140
  opts[:log] = {level: @log_level} if @log_level
141
141
 
142
- {KEY => opts}
142
+ {KEY => generate_as_json(opts)}
143
143
  end
144
144
 
145
145
  private
@@ -37,7 +37,7 @@ module Selenium
37
37
  opts[:url] ||= service_url(opts)
38
38
 
39
39
  listener = opts.delete(:listener)
40
- @bridge = Remote::Bridge.handshake(opts)
40
+ @bridge = Remote::Bridge.handshake(**opts)
41
41
  super(@bridge, listener: listener)
42
42
  end
43
43
 
@@ -20,7 +20,7 @@
20
20
  module Selenium
21
21
  module WebDriver
22
22
  module IE
23
- class Options
23
+ class Options < WebDriver::Common::Options
24
24
  KEY = 'se:ieOptions'
25
25
  SCROLL_TOP = 0
26
26
  SCROLL_BOTTOM = 1
@@ -130,7 +130,7 @@ module Selenium
130
130
  opts['ie.browserCommandLineSwitches'] = @args.to_a.join(' ') if @args.any?
131
131
  opts.merge!(@options)
132
132
 
133
- {KEY => opts}
133
+ {KEY => generate_as_json(opts)}
134
134
  end
135
135
  end # Options
136
136
  end # IE
@@ -57,9 +57,9 @@ module Selenium
57
57
 
58
58
  case bridge.dialect
59
59
  when :oss
60
- Remote::OSS::Bridge.new(capabilities, bridge.session_id, opts)
60
+ Remote::OSS::Bridge.new(capabilities, bridge.session_id, **opts)
61
61
  when :w3c
62
- Remote::W3C::Bridge.new(capabilities, bridge.session_id, opts)
62
+ Remote::W3C::Bridge.new(capabilities, bridge.session_id, **opts)
63
63
  else
64
64
  raise WebDriverError, 'cannot understand dialect'
65
65
  end
@@ -37,7 +37,7 @@ module Selenium
37
37
  opts[:url] ||= service_url(opts)
38
38
 
39
39
  listener = opts.delete(:listener)
40
- @bridge = Remote::Bridge.handshake(opts)
40
+ @bridge = Remote::Bridge.handshake(**opts)
41
41
  @bridge.extend Bridge
42
42
 
43
43
  super(@bridge, listener: listener)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Selenium
21
21
  module WebDriver
22
- VERSION = '3.142.6'
22
+ VERSION = '3.142.7'
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: 3.142.6
4
+ version: 3.142.7
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-10-04 00:00:00.000000000 Z
13
+ date: 2019-12-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +240,7 @@ files:
240
240
  - lib/selenium/webdriver/common/manager.rb
241
241
  - lib/selenium/webdriver/common/mouse.rb
242
242
  - lib/selenium/webdriver/common/navigation.rb
243
+ - lib/selenium/webdriver/common/options.rb
243
244
  - lib/selenium/webdriver/common/platform.rb
244
245
  - lib/selenium/webdriver/common/port_prober.rb
245
246
  - lib/selenium/webdriver/common/profile_helper.rb