selenium-webdriver 3.5.1 → 3.5.2

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.
data/CHANGES CHANGED
@@ -1,3 +1,22 @@
1
+ 3.5.2 (2017-09-07)
2
+ ==================
3
+
4
+ Ruby:
5
+ * Removed platformVersion from W3C payload (issue #4641)
6
+ * Fixed a bug when proxy type was not compliant to specification (issue #4574)
7
+ * Added support for passing speed to flick action (issue #4549)
8
+ * Using TouchActionBuilder no longer prints mouse/key deprecations
9
+ * Deprecated Alert#authenticate
10
+ * Added support for DEBUG environment variable which enables full debug mode in gem
11
+
12
+ Firefox:
13
+ * Fixed a bug when page load timeout was not properly constructed in new session payload
14
+ * Fixed a bug when GeckoDriver error stacktrace was not displayed (issue #3683)
15
+
16
+ Chrome:
17
+ * Added workardound for the case when findElements call returns null (issue #4555)
18
+ * Chrome::Driver now includes touch actions by default
19
+
1
20
  3.5.1 (2017-08-15)
2
21
  ==================
3
22
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- selenium-webdriver (3.5.0)
4
+ selenium-webdriver (3.5.1)
5
5
  childprocess (~> 0.5)
6
6
  rubyzip (~> 1.0)
7
7
 
@@ -10,7 +10,7 @@ GEM
10
10
  specs:
11
11
  addressable (2.5.1)
12
12
  public_suffix (~> 2.0, >= 2.0.2)
13
- childprocess (0.7.0)
13
+ childprocess (0.7.1)
14
14
  ffi (~> 1.0, >= 1.0.11)
15
15
  crack (0.4.3)
16
16
  safe_yaml (~> 1.0.0)
@@ -53,4 +53,4 @@ DEPENDENCIES
53
53
  yard (~> 0.9.9)
54
54
 
55
55
  BUNDLED WITH
56
- 1.15.3
56
+ 1.15.4
@@ -27,6 +27,7 @@ module Selenium
27
27
  #
28
28
 
29
29
  class Driver < WebDriver::Driver
30
+ include DriverExtensions::HasTouchScreen
30
31
  include DriverExtensions::HasWebStorage
31
32
  include DriverExtensions::TakesScreenshot
32
33
 
@@ -129,11 +129,11 @@ module Selenium
129
129
  #
130
130
  # @example Start Chrome in mobile emulation mode by device name
131
131
  # options = Selenium::WebDriver::Chrome::Options.new
132
- # options.add_emulated_device(device_name: 'iPhone 6')
132
+ # options.add_emulation(device_name: 'iPhone 6')
133
133
  #
134
134
  # @example Start Chrome in mobile emulation mode by device metrics
135
135
  # options = Selenium::WebDriver::Chrome::Options.new
136
- # options.add_emulated_device(device_metrics: {width: 400, height: 800, pixelRatio: 1, touch: true})
136
+ # options.add_emulation(device_metrics: {width: 400, height: 800, pixelRatio: 1, touch: true})
137
137
  #
138
138
  # @param [String] device_name Name of the device or a hash containing width, height, pixelRatio, touch
139
139
  # @param [Hash] device_metrics Hash containing width, height, pixelRatio, touch
@@ -44,6 +44,7 @@ module Selenium
44
44
  end
45
45
 
46
46
  def authenticate(username, password)
47
+ WebDriver.logger.deprecate 'Alert#authenticate'
47
48
  @bridge.authentication(username: username, password: password)
48
49
  accept
49
50
  end
@@ -22,7 +22,7 @@ module Selenium
22
22
  module DriverExtensions
23
23
  module HasTouchScreen
24
24
  def touch
25
- TouchActionBuilder.new mouse, keyboard, touch_screen
25
+ TouchActionBuilder.new Mouse.new(@bridge), Keyboard.new(@bridge), touch_screen
26
26
  end
27
27
 
28
28
  private
@@ -101,13 +101,20 @@ module Selenium
101
101
  end
102
102
 
103
103
  #
104
- # Marks code as deprecated with replacement.
104
+ # Marks code as deprecated with/without replacement.
105
105
  #
106
106
  # @param [String] old
107
- # @param [String] new
107
+ # @param [String, nil] new
108
108
  #
109
- def deprecate(old, new)
110
- warn "[DEPRECATION] #{old} is deprecated. Use #{new} instead."
109
+ def deprecate(old, new = nil)
110
+ message = "[DEPRECATION] #{old} is deprecated"
111
+ message << if new
112
+ ". Use #{new} instead."
113
+ else
114
+ ' and will be removed in the next releases.'
115
+ end
116
+
117
+ warn message
111
118
  end
112
119
 
113
120
  private
@@ -115,13 +122,21 @@ module Selenium
115
122
  def create_logger(output)
116
123
  logger = ::Logger.new(output)
117
124
  logger.progname = 'Selenium'
118
- logger.level = ($DEBUG ? DEBUG : WARN)
125
+ logger.level = default_level
119
126
  logger.formatter = proc do |severity, time, progname, msg|
120
127
  "#{time.strftime('%F %T')} #{severity} #{progname} #{msg}\n"
121
128
  end
122
129
 
123
130
  logger
124
131
  end
132
+
133
+ def default_level
134
+ if $DEBUG || ENV.key?('DEBUG')
135
+ DEBUG
136
+ else
137
+ WARN
138
+ end
139
+ end
125
140
  end # Logger
126
141
  end # WebDriver
127
142
  end # Selenium
File without changes
File without changes
@@ -83,13 +83,14 @@ module Selenium
83
83
  element, xoffset, yoffset, speed = args
84
84
 
85
85
  assert_element element
86
- flick_speed = FLICK_SPEED[speed.to_sym]
87
86
 
88
- unless flick_speed
89
- raise ArgumentError, "expected one of #{FLICK_SPEED.keys.inspect}, got #{speed.inspect}"
87
+ if (speed.is_a?(String) || speed.is_a?(Symbol)) && FLICK_SPEED.keys.include?(speed.to_sym)
88
+ WebDriver.logger.deprecate "Passing #{speed.inspect} speed",
89
+ "Integer or Selenium::WebDriver::TouchScreen::FLICK_SPEED[:#{speed}]"
90
+ speed = FLICK_SPEED[speed.to_sym]
90
91
  end
91
92
 
92
- @bridge.touch_element_flick element.ref, Integer(xoffset), Integer(yoffset), flick_speed
93
+ @bridge.touch_element_flick element.ref, Integer(xoffset), Integer(yoffset), Integer(speed)
93
94
  else
94
95
  raise ArgumentError, "wrong number of arguments, expected 2 or 4, got #{args.size}"
95
96
  end
File without changes
@@ -558,6 +558,8 @@ module Selenium
558
558
  else
559
559
  execute :find_elements, {}, {using: how, value: what}
560
560
  end
561
+ # see https://github.com/SeleniumHQ/selenium/issues/4555
562
+ ids ||= []
561
563
 
562
564
  ids.map { |id| Element.new self, element_id_from(id) }
563
565
  end
@@ -22,6 +22,8 @@ module Selenium
22
22
  module Remote
23
23
  # @api private
24
24
  class Response
25
+ STACKTRACE_KEY = 'stackTrace'.freeze
26
+
25
27
  attr_reader :code, :payload
26
28
  attr_writer :payload
27
29
 
@@ -73,11 +75,25 @@ module Selenium
73
75
  end
74
76
 
75
77
  def add_backtrace(ex)
76
- return unless value.is_a?(Hash) && value['stackTrace']
78
+ return unless error_payload.is_a?(Hash)
79
+
80
+ server_trace = error_payload[STACKTRACE_KEY] ||
81
+ error_payload[STACKTRACE_KEY.downcase] ||
82
+ error_payload['value'][STACKTRACE_KEY]
83
+ return unless server_trace
77
84
 
78
- server_trace = value['stackTrace']
85
+ backtrace = case server_trace
86
+ when Array
87
+ backtrace_from_remote(server_trace)
88
+ when String
89
+ server_trace.split("\n")
90
+ end
79
91
 
80
- backtrace = server_trace.map do |frame|
92
+ ex.set_backtrace(backtrace + ex.backtrace)
93
+ end
94
+
95
+ def backtrace_from_remote(server_trace)
96
+ server_trace.map do |frame|
81
97
  next unless frame.is_a?(Hash)
82
98
 
83
99
  file = frame['fileName']
@@ -91,8 +107,6 @@ module Selenium
91
107
 
92
108
  "[remote server] #{file}:#{line}:in `#{meth}'"
93
109
  end.compact
94
-
95
- ex.set_backtrace(backtrace + ex.backtrace)
96
110
  end
97
111
 
98
112
  def error_payload
File without changes
@@ -35,29 +35,32 @@ module Selenium
35
35
  # @api private
36
36
  #
37
37
 
38
- # TODO - uncomment when Mozilla fixes this:
39
- # https://bugzilla.mozilla.org/show_bug.cgi?id=1326397
40
38
  class Capabilities
41
39
 
42
40
  EXTENSION_CAPABILITY_PATTERN = /\A[\w-]+:.*\z/
43
41
 
44
- # TODO (alex): compare with spec
45
42
  KNOWN = [
46
43
  :browser_name,
47
44
  :browser_version,
48
45
  :platform_name,
49
- :platform_version,
50
46
  :accept_insecure_certs,
51
47
  :page_load_strategy,
52
48
  :proxy,
49
+ :set_window_rect,
50
+ :timeouts,
51
+ :unhandled_prompt_behavior,
52
+
53
+ # remote-specific
53
54
  :remote_session_id,
55
+
56
+ # TODO (alex): deprecate in favor of Firefox::Options?
54
57
  :accessibility_checks,
55
58
  :device,
59
+
60
+ # TODO (alex): deprecate compatibility with OSS-capabilities
56
61
  :implicit_timeout,
57
62
  :page_load_timeout,
58
63
  :script_timeout,
59
- :unhandled_prompt_behavior,
60
- :timeouts,
61
64
  ].freeze
62
65
 
63
66
  KNOWN.each do |key|
@@ -96,7 +99,7 @@ module Selenium
96
99
  opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
97
100
  opts[:timeouts] = {}
98
101
  opts[:timeouts]['implicit'] = opts.delete(:implicit_timeout) if opts.key?(:implicit_timeout)
99
- opts[:timeouts]['page load'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
102
+ opts[:timeouts]['pageLoad'] = opts.delete(:page_load_timeout) if opts.key?(:page_load_timeout)
100
103
  opts[:timeouts]['script'] = opts.delete(:script_timeout) if opts.key?(:script_timeout)
101
104
  new({browser_name: 'firefox', marionette: true}.merge(opts))
102
105
  end
@@ -114,7 +117,6 @@ module Selenium
114
117
  caps.browser_name = data.delete('browserName')
115
118
  caps.browser_version = data.delete('browserVersion')
116
119
  caps.platform_name = data.delete('platformName')
117
- caps.platform_version = data.delete('platformVersion')
118
120
  caps.accept_insecure_certs = data.delete('acceptInsecureCerts') if data.key?('acceptInsecureCerts')
119
121
  caps.page_load_strategy = data.delete('pageLoadStrategy')
120
122
  timeouts = data.delete('timeouts')
@@ -196,7 +198,6 @@ module Selenium
196
198
  # @option :browser_name [String] required browser name
197
199
  # @option :browser_version [String] required browser version number
198
200
  # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
199
- # @option :platform_version [String] required platform version number
200
201
  # @option :accept_insecure_certs [Boolean] does the driver accept insecure SSL certifications?
201
202
  # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
202
203
  #
@@ -253,7 +254,10 @@ module Selenium
253
254
  when :platform
254
255
  hash['platform'] = value.to_s.upcase
255
256
  when :proxy
256
- hash['proxy'] = value.as_json if value
257
+ if value
258
+ hash['proxy'] = value.as_json
259
+ hash['proxy']['proxyType'] &&= hash['proxy']['proxyType'].downcase
260
+ end
257
261
  when String, :firefox_binary
258
262
  hash[key.to_s] = value
259
263
  when Symbol
@@ -5,7 +5,7 @@ raise "cwd must be #{root} when reading gemspec" if root != Dir.pwd
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'selenium-webdriver'
8
- s.version = '3.5.1'
8
+ s.version = '3.5.2'
9
9
 
10
10
  s.authors = ['Alex Rodionov', 'Titus Fortner']
11
11
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.5.1
5
+ version: 3.5.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Rodionov
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2017-08-15 00:00:00 +07:00
14
+ date: 2017-09-07 00:00:00 +07:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency