webdrivers 3.9.1 → 3.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE.md +13 -13
- data/.gitignore +7 -7
- data/.rubocop.yml +44 -44
- data/.travis.yml +24 -24
- data/CHANGELOG.md +137 -133
- data/Gemfile +6 -6
- data/LICENSE.txt +22 -22
- data/README.md +169 -169
- data/Rakefile +11 -11
- data/appveyor.yml +22 -22
- data/lib/webdrivers.rb +6 -6
- data/lib/webdrivers/chromedriver.rb +185 -167
- data/lib/webdrivers/common.rb +191 -157
- data/lib/webdrivers/geckodriver.rb +80 -72
- data/lib/webdrivers/iedriver.rb +70 -62
- data/lib/webdrivers/logger.rb +111 -111
- data/lib/webdrivers/mswebdriver.rb +55 -55
- data/lib/webdrivers/network.rb +61 -58
- data/lib/webdrivers/system.rb +154 -151
- data/spec/spec_helper.rb +18 -18
- data/spec/webdrivers/chromedriver_spec.rb +257 -243
- data/spec/webdrivers/geckodriver_spec.rb +210 -210
- data/spec/webdrivers/i_edriver_spec.rb +192 -192
- data/spec/webdrivers/ms_webdriver_spec.rb +30 -30
- data/spec/webdrivers_proxy_support_spec.rb +53 -53
- data/webdrivers.gemspec +31 -31
- metadata +4 -11
data/lib/webdrivers.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'webdrivers/chromedriver'
|
4
|
-
require 'webdrivers/geckodriver'
|
5
|
-
require 'webdrivers/iedriver'
|
6
|
-
require 'webdrivers/mswebdriver'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'webdrivers/chromedriver'
|
4
|
+
require 'webdrivers/geckodriver'
|
5
|
+
require 'webdrivers/iedriver'
|
6
|
+
require 'webdrivers/mswebdriver'
|
@@ -1,167 +1,185 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'shellwords'
|
4
|
-
require 'webdrivers/common'
|
5
|
-
|
6
|
-
module Webdrivers
|
7
|
-
class Chromedriver < Common
|
8
|
-
class << self
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'shellwords'
|
4
|
+
require 'webdrivers/common'
|
5
|
+
|
6
|
+
module Webdrivers
|
7
|
+
class Chromedriver < Common
|
8
|
+
class << self
|
9
|
+
#
|
10
|
+
# Returns current chromedriver version.
|
11
|
+
#
|
12
|
+
# @return [Gem::Version]
|
13
|
+
def current_version
|
14
|
+
Webdrivers.logger.debug 'Checking current version'
|
15
|
+
return nil unless exists?
|
16
|
+
|
17
|
+
version = binary_version
|
18
|
+
return nil if version.nil?
|
19
|
+
|
20
|
+
# Matches 2.46, 2.46.628411 and 73.0.3683.75
|
21
|
+
normalize_version version[/\d+\.\d+(\.\d+)?(\.\d+)?/]
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Returns latest available chromedriver version.
|
26
|
+
#
|
27
|
+
# @return [Gem::Version]
|
28
|
+
def latest_version
|
29
|
+
@latest_version ||= begin
|
30
|
+
# Versions before 70 do not have a LATEST_RELEASE file
|
31
|
+
return normalize_version('2.41') if release_version < normalize_version('70')
|
32
|
+
|
33
|
+
latest_applicable = with_cache(file_name) { latest_point_release(release_version) }
|
34
|
+
|
35
|
+
Webdrivers.logger.debug "Latest version available: #{latest_applicable}"
|
36
|
+
normalize_version(latest_applicable)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Returns currently installed Chrome/Chromium version.
|
42
|
+
#
|
43
|
+
# @return [Gem::Version]
|
44
|
+
def chrome_version
|
45
|
+
ver = send("chrome_on_#{System.platform}").chomp
|
46
|
+
|
47
|
+
raise VersionError, 'Failed to find Chrome binary or its version.' if ver.nil? || ver.empty?
|
48
|
+
|
49
|
+
Webdrivers.logger.debug "Browser version: #{ver}"
|
50
|
+
normalize_version ver[/\d+\.\d+\.\d+\.\d+/] # Google Chrome 73.0.3683.75 -> 73.0.3683.75
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def latest_point_release(version)
|
56
|
+
normalize_version(Network.get(URI.join(base_url, "LATEST_RELEASE_#{version}")))
|
57
|
+
rescue NetworkError
|
58
|
+
msg = "Unable to find latest point release version for #{version}."
|
59
|
+
msg = begin
|
60
|
+
latest_release = normalize_version(Network.get(URI.join(base_url, 'LATEST_RELEASE')))
|
61
|
+
if version > latest_release
|
62
|
+
"#{msg} You appear to be using a non-production version of Chrome."
|
63
|
+
else
|
64
|
+
msg
|
65
|
+
end
|
66
|
+
rescue NetworkError
|
67
|
+
"#{msg} A network issue is preventing determination of latest chromedriver release."
|
68
|
+
end
|
69
|
+
|
70
|
+
msg = "#{msg} Please set `Webdrivers::Chromedriver.required_version = <desired driver version>` "\
|
71
|
+
'to a known chromedriver version: https://chromedriver.storage.googleapis.com/index.html'
|
72
|
+
|
73
|
+
Webdrivers.logger.debug msg
|
74
|
+
raise VersionError, msg
|
75
|
+
end
|
76
|
+
|
77
|
+
def file_name
|
78
|
+
System.platform == 'win' ? 'chromedriver.exe' : 'chromedriver'
|
79
|
+
end
|
80
|
+
|
81
|
+
def base_url
|
82
|
+
'https://chromedriver.storage.googleapis.com'
|
83
|
+
end
|
84
|
+
|
85
|
+
def download_url
|
86
|
+
return @download_url if @download_url
|
87
|
+
|
88
|
+
version = if required_version == EMPTY_VERSION
|
89
|
+
latest_version
|
90
|
+
else
|
91
|
+
normalize_version(required_version)
|
92
|
+
end
|
93
|
+
|
94
|
+
file_name = System.platform == 'win' ? 'win32' : "#{System.platform}64"
|
95
|
+
url = "#{base_url}/#{version}/chromedriver_#{file_name}.zip"
|
96
|
+
Webdrivers.logger.debug "chromedriver URL: #{url}"
|
97
|
+
@download_url = url
|
98
|
+
end
|
99
|
+
|
100
|
+
# Returns release version from the currently installed Chrome version
|
101
|
+
#
|
102
|
+
# @example
|
103
|
+
# 73.0.3683.75 -> 73.0.3683
|
104
|
+
def release_version
|
105
|
+
chrome = normalize_version(chrome_version)
|
106
|
+
normalize_version(chrome.segments[0..2].join('.'))
|
107
|
+
end
|
108
|
+
|
109
|
+
def chrome_on_win
|
110
|
+
if browser_binary
|
111
|
+
Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
|
112
|
+
return System.call("powershell (Get-ItemProperty '#{browser_binary}').VersionInfo.ProductVersion").strip
|
113
|
+
end
|
114
|
+
|
115
|
+
# Workaround for Google Chrome when using Jruby on Windows.
|
116
|
+
# @see https://github.com/titusfortner/webdrivers/issues/41
|
117
|
+
if RUBY_PLATFORM == 'java'
|
118
|
+
ver = 'powershell (Get-Item -Path ((Get-ItemProperty "HKLM:\\Software\\Microsoft' \
|
119
|
+
"\\Windows\\CurrentVersion\\App` Paths\\chrome.exe\").\\'(default)\\'))" \
|
120
|
+
'.VersionInfo.ProductVersion'
|
121
|
+
return System.call(ver).strip
|
122
|
+
end
|
123
|
+
|
124
|
+
# Default to Google Chrome
|
125
|
+
reg = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
|
126
|
+
executable = System.call("powershell (Get-ItemProperty '#{reg}' -Name '(default)').'(default)'").strip
|
127
|
+
Webdrivers.logger.debug "Browser executable: '#{executable}'"
|
128
|
+
ps = "(Get-Item (Get-ItemProperty '#{reg}').'(default)').VersionInfo.ProductVersion"
|
129
|
+
System.call("powershell #{ps}").strip
|
130
|
+
end
|
131
|
+
|
132
|
+
def chrome_on_linux
|
133
|
+
if browser_binary
|
134
|
+
Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
|
135
|
+
return System.call("#{Shellwords.escape browser_binary} --product-version").strip
|
136
|
+
end
|
137
|
+
|
138
|
+
# Default to Google Chrome
|
139
|
+
executable = System.call('which google-chrome').strip
|
140
|
+
Webdrivers.logger.debug "Browser executable: '#{executable}'"
|
141
|
+
System.call("#{executable} --product-version").strip
|
142
|
+
end
|
143
|
+
|
144
|
+
def chrome_on_mac
|
145
|
+
if browser_binary
|
146
|
+
Webdrivers.logger.debug "Browser executable: '#{browser_binary}'"
|
147
|
+
return System.call("#{Shellwords.escape browser_binary} --version").strip
|
148
|
+
end
|
149
|
+
|
150
|
+
# Default to Google Chrome
|
151
|
+
executable = Shellwords.escape '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
|
152
|
+
Webdrivers.logger.debug "Browser executable: #{executable}"
|
153
|
+
System.call("#{executable} --version").strip
|
154
|
+
end
|
155
|
+
|
156
|
+
#
|
157
|
+
# Returns user defined browser executable path from Selenium::WebDrivers::Chrome#path.
|
158
|
+
#
|
159
|
+
def browser_binary
|
160
|
+
# For Chromium, Brave, or whatever else
|
161
|
+
Selenium::WebDriver::Chrome.path
|
162
|
+
end
|
163
|
+
|
164
|
+
def sufficient_binary?
|
165
|
+
super && current_version && (current_version < normalize_version('70.0.3538') ||
|
166
|
+
current_version.segments.first == release_version.segments.first)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
if ::Selenium::WebDriver::Service.respond_to? :driver_path=
|
173
|
+
::Selenium::WebDriver::Chrome::Service.driver_path = proc { ::Webdrivers::Chromedriver.update }
|
174
|
+
else
|
175
|
+
# v3.141.0 and lower
|
176
|
+
module Selenium
|
177
|
+
module WebDriver
|
178
|
+
module Chrome
|
179
|
+
def self.driver_path
|
180
|
+
@driver_path ||= Webdrivers::Chromedriver.update
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
data/lib/webdrivers/common.rb
CHANGED
@@ -1,157 +1,191 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems/package'
|
4
|
-
require 'zip'
|
5
|
-
require 'webdrivers/logger'
|
6
|
-
require 'webdrivers/network'
|
7
|
-
require 'webdrivers/system'
|
8
|
-
require 'selenium-webdriver'
|
9
|
-
|
10
|
-
module Webdrivers
|
11
|
-
class ConnectionError < StandardError
|
12
|
-
end
|
13
|
-
|
14
|
-
class VersionError < StandardError
|
15
|
-
end
|
16
|
-
|
17
|
-
class
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
def
|
78
|
-
@
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rubygems/package'
|
4
|
+
require 'zip'
|
5
|
+
require 'webdrivers/logger'
|
6
|
+
require 'webdrivers/network'
|
7
|
+
require 'webdrivers/system'
|
8
|
+
require 'selenium-webdriver'
|
9
|
+
|
10
|
+
module Webdrivers
|
11
|
+
class ConnectionError < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
class VersionError < StandardError
|
15
|
+
end
|
16
|
+
|
17
|
+
class NetworkError < StandardError
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
attr_accessor :proxy_addr, :proxy_port, :proxy_user, :proxy_pass, :install_dir
|
22
|
+
|
23
|
+
attr_writer :cache_time
|
24
|
+
|
25
|
+
#
|
26
|
+
# Returns the amount of time (Seconds) the gem waits between two update checks.
|
27
|
+
#
|
28
|
+
def cache_time
|
29
|
+
@cache_time || 0
|
30
|
+
end
|
31
|
+
|
32
|
+
def logger
|
33
|
+
@logger ||= Webdrivers::Logger.new
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Provides a convenient way to configure the gem.
|
38
|
+
#
|
39
|
+
# @example Configure proxy and cache_time
|
40
|
+
# Webdrivers.configure do |config|
|
41
|
+
# config.proxy_addr = 'myproxy_address.com'
|
42
|
+
# config.proxy_port = '8080'
|
43
|
+
# config.proxy_user = 'username'
|
44
|
+
# config.proxy_pass = 'password'
|
45
|
+
# config.cache_time = 604_800 # 7 days
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
def configure
|
49
|
+
yield self
|
50
|
+
end
|
51
|
+
|
52
|
+
def net_http_ssl_fix
|
53
|
+
raise 'Webdrivers.net_http_ssl_fix is no longer available.' \
|
54
|
+
' Please see https://github.com/titusfortner/webdrivers#ssl_connect-errors.'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class Common
|
59
|
+
class << self
|
60
|
+
attr_writer :required_version
|
61
|
+
attr_reader :cache_warning
|
62
|
+
|
63
|
+
def version
|
64
|
+
Webdrivers.logger.deprecate("#{self.class}#version", "#{self.class}#required_version")
|
65
|
+
required_version
|
66
|
+
end
|
67
|
+
|
68
|
+
def version=(version)
|
69
|
+
Webdrivers.logger.deprecate("#{self.class}#version=", "#{self.class}#required_version=")
|
70
|
+
self.required_version = version
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Returns the user defined required version.
|
75
|
+
#
|
76
|
+
# @return [Gem::Version]
|
77
|
+
def required_version
|
78
|
+
normalize_version @required_version
|
79
|
+
end
|
80
|
+
|
81
|
+
#
|
82
|
+
# Triggers an update check.
|
83
|
+
#
|
84
|
+
# @return [String] Path to the driver binary.
|
85
|
+
def update
|
86
|
+
if correct_binary?
|
87
|
+
msg = required_version != EMPTY_VERSION ? 'The required webdriver version' : 'A working webdriver version'
|
88
|
+
Webdrivers.logger.debug "#{msg} is already on the system"
|
89
|
+
return driver_path
|
90
|
+
end
|
91
|
+
|
92
|
+
remove
|
93
|
+
System.download(download_url, driver_path)
|
94
|
+
end
|
95
|
+
|
96
|
+
def desired_version
|
97
|
+
old = "#{self.class}#desired_version"
|
98
|
+
new = "#{self.class}#required_version or #{self.class}#latest_version"
|
99
|
+
Webdrivers.logger.deprecate(old, new)
|
100
|
+
|
101
|
+
desired_version == EMPTY_VERSION ? latest_version : normalize_version(desired_version)
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Deletes the existing driver binary.
|
106
|
+
#
|
107
|
+
def remove
|
108
|
+
@download_url = nil
|
109
|
+
@latest_version = nil
|
110
|
+
System.delete "#{System.install_dir}/#{file_name.gsub('.exe', '')}.version"
|
111
|
+
System.delete driver_path
|
112
|
+
end
|
113
|
+
|
114
|
+
def download
|
115
|
+
Webdrivers.logger.deprecate('#download', '#update')
|
116
|
+
System.download(download_url, driver_path)
|
117
|
+
end
|
118
|
+
|
119
|
+
def binary
|
120
|
+
Webdrivers.logger.deprecate('#binary', '#driver_path')
|
121
|
+
driver_path
|
122
|
+
end
|
123
|
+
|
124
|
+
#
|
125
|
+
# Returns path to the driver binary.
|
126
|
+
#
|
127
|
+
# @return [String]
|
128
|
+
def driver_path
|
129
|
+
File.join System.install_dir, file_name
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def download_url
|
135
|
+
@download_url ||= if required_version == EMPTY_VERSION
|
136
|
+
downloads[downloads.keys.max]
|
137
|
+
else
|
138
|
+
downloads[normalize_version(required_version)]
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def exists?
|
143
|
+
System.exists? driver_path
|
144
|
+
end
|
145
|
+
|
146
|
+
def correct_binary?
|
147
|
+
current_version == if required_version == EMPTY_VERSION
|
148
|
+
latest_version
|
149
|
+
else
|
150
|
+
normalize_version(required_version)
|
151
|
+
end
|
152
|
+
rescue ConnectionError, VersionError
|
153
|
+
driver_path if sufficient_binary?
|
154
|
+
end
|
155
|
+
|
156
|
+
def sufficient_binary?
|
157
|
+
exists?
|
158
|
+
end
|
159
|
+
|
160
|
+
def normalize_version(version)
|
161
|
+
Gem::Version.new(version.to_s)
|
162
|
+
end
|
163
|
+
|
164
|
+
def binary_version
|
165
|
+
version = System.call("#{driver_path} --version")
|
166
|
+
Webdrivers.logger.debug "Current version of #{driver_path} is #{version}"
|
167
|
+
version
|
168
|
+
rescue Errno::ENOENT
|
169
|
+
Webdrivers.logger.debug "No Such File or Directory: #{driver_path}"
|
170
|
+
nil
|
171
|
+
end
|
172
|
+
|
173
|
+
def with_cache(file_name)
|
174
|
+
if System.valid_cache?(file_name)
|
175
|
+
normalize_version System.cached_version(file_name)
|
176
|
+
else
|
177
|
+
unless cache_warning
|
178
|
+
Webdrivers.logger.warn 'Driver caching is turned off in this version, but will be '\
|
179
|
+
'enabled by default in 4.x. Set the value with `Webdrivers#cache_time=` in seconds'
|
180
|
+
@cache_warning = true
|
181
|
+
end
|
182
|
+
version = yield
|
183
|
+
System.cache_version(file_name, version)
|
184
|
+
normalize_version version
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
EMPTY_VERSION = Gem::Version.new('')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|