webdrivers 3.3.0 → 3.3.1

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: 38a8045b1c217acbc4ef3163a4c5cf9c7b49f39d
4
- data.tar.gz: c37958c1c522eaa4678052ffa59699287f182cce
3
+ metadata.gz: 5e797daab91623814fcd8a1d5ab92edccf0be063
4
+ data.tar.gz: d0f7101c1f88765150d2fdba2dd47974f2adb298
5
5
  SHA512:
6
- metadata.gz: 3f393257af259775e469647eb1d6bd3bc2afd869ffc7fbf03a9bf00188d6be30157cf214610f0398c0451f06ef99b1d3d9ff0abbe5769c1595373308e097cacf
7
- data.tar.gz: 30e8898a5314378a9df00b15100bdb5c63e914b991d683b42fccc3422ddd351ebcf4c0f67b181df010418333ca7dfcd3c35a49045f069337dce7e02a9a768977
6
+ metadata.gz: 221dfa39597516e7f7dd876f52095dc87af490f72f82cb417776ccd86918609656d408eebf9dd2768523a5cad2f24d378b71bad534e09909c31501ab96e44c01
7
+ data.tar.gz: 2f2c9732436f84bdc4a1a2a21fd6d693d5722eb50af22aeffb18f68fd34c9365b0bf3abae0585f3beb758f4ce603a66ca74a59877c66ade2f274c01e95885239
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 3.3.1 (2018-05-04)
2
+
3
+ * Fix bug with MSWebdriver to fetch the correct driver instead of latest (Thanks kapoorlakshya)
4
+
1
5
  ### 3.3.0 (2018-04-29)
2
6
 
3
7
  * Ensures downloading correct MSWebdriver version (Thanks kapoorlakshya)
data/README.md CHANGED
@@ -24,7 +24,7 @@ in your Gemfile:
24
24
 
25
25
  in your project:
26
26
 
27
- `require 'webdrivers'
27
+ `require 'webdrivers'`
28
28
 
29
29
  If there is a proxy between you and the Internet then you will need to configure
30
30
  the gem to use the proxy. You can do this by calling the `configure` method.
@@ -38,6 +38,18 @@ Webdrivers.configure do |config|
38
38
  end
39
39
  ````
40
40
 
41
+ **Note when using Microsoft Edge**:
42
+
43
+ After updating Microsoft Edge on Windows 10, you will need to delete the existing binary (`%USERPROFILE%/.webdrivers/MicrosoftWebDriver.exe`) to
44
+ to be able to download the latest version through this gem.
45
+
46
+ This is because `MicrosoftWebDriver.exe` is not backwards compatible and it does not have an argument to retrieve
47
+ the current version. We work around this limitation by querying the current Edge version from the registry and
48
+ fetching the corresponding binary IF a file does not already exist. If a file does exist, the gem assumes it is the
49
+ expected version and skips the download process.
50
+
51
+ If you continue with the outdated binary, Selenium will throw an error: `unable to connect to MicrosoftWebDriver localhost:17556`.
52
+
41
53
  # License
42
54
 
43
55
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT),
@@ -9,24 +9,23 @@ module Webdrivers
9
9
  unless site_available?
10
10
  return current.nil? ? nil : binary
11
11
  end
12
- released = latest()
13
- location = binary()
14
- binary_exists = File.exists?(location)
12
+ released = latest()
13
+ location = binary()
15
14
 
16
- return location if released.nil? && binary_exists
15
+ return location if released.nil? && File.exists?(binary) # Newer not found, keep current
17
16
 
18
- if released.nil?
17
+ if released.nil? # Can't find latest and no existing binary
19
18
  msg = "Unable to find the latest version of #{file_name}; try downloading manually from #{base_url} and place in #{install_dir}"
20
19
  raise StandardError, msg
21
20
  end
22
21
 
23
- if current == released && binary_exists # Already have latest/matching one
22
+ if correct_binary?
24
23
  Webdrivers.logger.debug "Expected webdriver version found"
25
24
  return location
26
25
  end
27
26
 
28
- remove if binary_exists # Remove outdated exe
29
- download
27
+ remove # Remove outdated exe
28
+ download # Fetch latest
30
29
  end
31
30
 
32
31
  def latest
@@ -178,6 +177,12 @@ module Webdrivers
178
177
  def install_dir
179
178
  File.expand_path(File.join(ENV['HOME'], ".webdrivers")).tap { |dir| FileUtils.mkdir_p dir }
180
179
  end
180
+
181
+ # Already have latest version downloaded?
182
+ def correct_binary?
183
+ latest == current && File.exists?(binary)
184
+ end
185
+
181
186
  end
182
187
  end
183
188
  end
@@ -1,5 +1,6 @@
1
1
  module Webdrivers
2
2
  class MSWebdriver < Common
3
+
3
4
  class << self
4
5
 
5
6
  def current
@@ -18,6 +19,13 @@ module Webdrivers
18
19
  build.to_i
19
20
  end
20
21
 
22
+ # Webdriver binaries for Microsoft Edge are not backwards compatible.
23
+ # For this reason, instead of downloading the latest binary we download the correct one for the
24
+ # currently installed browser version.
25
+ def download(version = current)
26
+ super
27
+ end
28
+
21
29
  private
22
30
 
23
31
  def normalize(string)
@@ -40,6 +48,13 @@ module Webdrivers
40
48
  def base_url
41
49
  'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'
42
50
  end
51
+
52
+ # Assume we have the latest if file exists since MicrosoftWebdriver.exe does not have an
53
+ # argument to check the current version.
54
+ def correct_binary?
55
+ File.exist?(binary)
56
+ end
57
+
43
58
  end
44
59
  end
45
60
  end
@@ -7,7 +7,7 @@ describe Webdrivers::Geckodriver do
7
7
  it 'raises exception if unable to get latest geckodriver and no geckodriver present' do
8
8
  geckodriver.remove
9
9
  allow(geckodriver).to receive(:latest).and_return(nil)
10
- msg = /^Unable to find the latest version of geckodriver; try downloading manually from (.*)?and place in (.*)?\.webdrivers$/
10
+ msg = /^Unable to find the latest version of geckodriver(.exe)?; try downloading manually from (.*)?and place in (.*)?\.webdrivers$/
11
11
  expect { geckodriver.update }.to raise_exception StandardError, msg
12
12
  end
13
13
 
@@ -6,7 +6,7 @@ describe Webdrivers::MSWebdriver do
6
6
 
7
7
  it 'downloads mswebdriver' do
8
8
  mswebdriver.remove
9
- allow(mswebdriver).to receive(:current).and_return(0)
9
+ allow(mswebdriver).to receive(:current)
10
10
  expect(File.exist?(mswebdriver.download)).to be true
11
11
  end
12
12
 
data/webdrivers.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "webdrivers"
6
- s.version = "3.3.0"
6
+ s.version = "3.3.1"
7
7
  s.authors = ["Titus Fortner"]
8
8
  s.email = ["titusfortner@gmail.com"]
9
9
  s.homepage = "https://github.com/titusfortner/webdrivers"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdrivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Titus Fortner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-30 00:00:00.000000000 Z
11
+ date: 2018-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec