selenium-webdriver 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,15 @@
1
+ 3.0.4 (2016-12-21)
2
+ ===================
3
+
4
+ Firefox:
5
+ * Implement profile support via geckodriver (#2933 thanks lmtierney)
6
+
7
+ Ruby:
8
+ * Fix bug preventing use of Curb client (#2951 thanks clarkenciel)
9
+ * Support Net::HTTP::Persistent version 3 (#3219 thanks Pete Johns)
10
+ * Allow Net::HTTP::Default to set open_timout and read_timeout independently (#3264 thanks richseviora)
11
+ * Change default for Net::HTTP::Default#open_timeout to facilitate debuggers (#3264 thanks richseviora)
12
+
1
13
  3.0.3 (2016-11-26)
2
14
  ===================
3
15
 
@@ -134,7 +146,7 @@ Firefox:
134
146
  2.49.0 (2016-01-13)
135
147
  ===================
136
148
 
137
- Ruby:
149
+ Ruby:g
138
150
  * support for SessionNotCreatedError (thanks Alexander Bayandin)
139
151
 
140
152
  Safari:
@@ -150,7 +150,7 @@ module Selenium
150
150
  paths.each do |path|
151
151
  full_path = File.join(path, binary_name)
152
152
  full_path.tr!('\\', '/') if windows?
153
- exe = Dir.glob(full_path).select { |f| File.executable?(f) }.first
153
+ exe = Dir.glob(full_path).find { |f| File.executable?(f) }
154
154
  return exe if exe
155
155
  end
156
156
  end
@@ -92,10 +92,6 @@ module Selenium
92
92
  def fetch_profile
93
93
  if @profile_name
94
94
  @profile = Profile.from_name @profile_name
95
-
96
- unless @profile
97
- raise Error::WebDriverError, "unable to find profile named: #{@profile_name.inspect}"
98
- end
99
95
  else
100
96
  @profile = Profile.new
101
97
  end
@@ -42,7 +42,9 @@ module Selenium
42
42
  end
43
43
 
44
44
  def from_name(name)
45
- ini[name]
45
+ profile = ini[name]
46
+ return profile if profile
47
+ raise Error::WebDriverError, "unable to find profile named: #{name.inspect}"
46
48
  end
47
49
 
48
50
  def default_preferences
@@ -193,6 +195,10 @@ module Selenium
193
195
  proxy
194
196
  end
195
197
 
198
+ def encoded
199
+ Zipper.zip(layout_on_disk)
200
+ end
201
+
196
202
  private
197
203
 
198
204
  def set_manual_proxy_preference(key, value)
@@ -57,11 +57,10 @@ module Selenium
57
57
  is_relative = Regexp.last_match(1).strip == '1'
58
58
  when /^Path=(.+)$/
59
59
  path = Regexp.last_match(1).strip
60
+ p = path_for(name, is_relative, path)
61
+ @profile_paths[name] = p if p
60
62
  end
61
63
  end
62
-
63
- p = path_for(name, is_relative, path)
64
- @profile_paths[name] = p if p
65
64
  end
66
65
 
67
66
  def path_for(name, is_relative, path)
@@ -59,6 +59,13 @@ module Selenium
59
59
  caps = opts.delete(:desired_capabilities) || Remote::W3CCapabilities.firefox
60
60
  firefox_options_caps = caps[:firefox_options] || {}
61
61
  caps[:firefox_options] = firefox_options_caps.merge(opts[:firefox_options] || {})
62
+ if opts.key?(:profile)
63
+ profile = opts.delete(:profile)
64
+ unless profile.is_a?(Profile)
65
+ profile = Profile.from_name(profile)
66
+ end
67
+ caps[:firefox_options][:profile] = profile.encoded
68
+ end
62
69
 
63
70
  Binary.path = caps[:firefox_options][:binary] if caps[:firefox_options].key?(:binary)
64
71
  caps
@@ -201,12 +201,10 @@ module Selenium
201
201
  switch_to_frame(nil)
202
202
  end
203
203
 
204
- QUIT_ERRORS = [IOError].freeze
205
-
206
204
  def quit
207
205
  execute :quit
208
206
  http.close
209
- rescue *QUIT_ERRORS
207
+ rescue *http.quit_errors
210
208
  end
211
209
 
212
210
  def close
@@ -33,6 +33,10 @@ module Selenium
33
33
  @timeout = nil
34
34
  end
35
35
 
36
+ def quit_errors
37
+ [IOError]
38
+ end
39
+
36
40
  def close
37
41
  # hook for subclasses - will be called on Driver#quit
38
42
  end
@@ -22,8 +22,6 @@ require 'curb'
22
22
  module Selenium
23
23
  module WebDriver
24
24
  module Remote
25
- # added for rescue
26
- Bridge::QUIT_ERRORS << Curl::Err::RecvError
27
25
 
28
26
  module Http
29
27
  #
@@ -40,6 +38,11 @@ module Selenium
40
38
  #
41
39
 
42
40
  class Curb < Common
41
+
42
+ def quit_errors
43
+ [Curl::Err::RecvError] + super
44
+ end
45
+
43
46
  private
44
47
 
45
48
  def request(verb, url, headers, payload)
@@ -28,6 +28,28 @@ module Selenium
28
28
  class Default < Common
29
29
  attr_accessor :proxy
30
30
 
31
+ attr_accessor :open_timeout
32
+ attr_accessor :read_timeout
33
+
34
+ # Initializes object.
35
+ # Warning: Setting {#open_timeout} to non-nil values will cause a separate thread to spawn.
36
+ # Debuggers that freeze the process will not be able to evaluate any operations if that happens.
37
+ # @param [Numeric] open_timeout - Open timeout to apply to HTTP client.
38
+ # @param [Numeric] read_timeout - Read timeout (seconds) to apply to HTTP client.
39
+ def initialize(open_timeout: nil, read_timeout: nil)
40
+ @open_timeout = open_timeout
41
+ @read_timeout = read_timeout
42
+ end
43
+
44
+ # Maintaining backward compatibility.
45
+ # @param [Numeric] value - Timeout in seconds to apply to both open timeout and read timeouts.
46
+ # @deprecated Please set the specific desired timeout {#read_timeout} or {#open_timeout} directly.
47
+ def timeout=(value)
48
+ Kernel.warn 'Selenium::WebDriver::Remote::Http::Default#timeout= is deprecated. Use #read_timeout= or #open_timeout= instead'
49
+ self.open_timeout = value
50
+ self.read_timeout = value
51
+ end
52
+
31
53
  private
32
54
 
33
55
  def http
@@ -38,10 +60,9 @@ module Selenium
38
60
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
39
61
  end
40
62
 
41
- if @timeout
42
- http.open_timeout = @timeout
43
- http.read_timeout = @timeout
44
- end
63
+ # Defaulting open_timeout to nil to be consistent with Ruby 2.2 and earlier.
64
+ http.open_timeout = self.open_timeout
65
+ http.read_timeout = self.read_timeout if self.read_timeout
45
66
 
46
67
  http
47
68
  )
@@ -42,7 +42,12 @@ module Selenium
42
42
  proxy = URI.parse(url)
43
43
  end
44
44
 
45
- Net::HTTP::Persistent.new 'webdriver', proxy
45
+ if Net::HTTP::Persistent::VERSION >= '3'
46
+ Net::HTTP::Persistent.new name: 'webdriver', proxy: proxy
47
+ else
48
+ warn 'Support for this version of net-http-persistent is deprecated. Please upgrade.'
49
+ Net::HTTP::Persistent.new 'webdriver', proxy
50
+ end
46
51
  end
47
52
 
48
53
  def response_for(request)
@@ -79,7 +79,7 @@ module Selenium
79
79
  opts[:browser_version] = opts.delete(:version) if opts.key?(:version)
80
80
  opts[:platform_name] = opts.delete(:platform) if opts.key?(:platform)
81
81
 
82
- new({browser_name: 'firefox'}.merge(opts))
82
+ new({browser_name: 'firefox', marionette: true}.merge(opts))
83
83
  end
84
84
 
85
85
  alias_method :ff, :firefox
@@ -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.0.3'
8
+ s.version = '3.0.4'
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.0.3
5
+ version: 3.0.4
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: 2016-11-26 00:00:00 -06:00
14
+ date: 2016-12-21 00:00:00 -06:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency