webdrivers 3.6.0 → 3.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +6 -6
- data/.travis.yml +11 -7
- data/CHANGELOG.md +100 -96
- data/Gemfile +4 -4
- data/LICENSE.txt +22 -22
- data/README.md +76 -76
- data/Rakefile +6 -6
- data/lib/webdrivers.rb +27 -27
- data/lib/webdrivers/chromedriver.rb +91 -48
- data/lib/webdrivers/common.rb +203 -203
- data/lib/webdrivers/geckodriver.rb +43 -43
- data/lib/webdrivers/iedriver.rb +43 -43
- data/lib/webdrivers/logger.rb +109 -109
- data/lib/webdrivers/mswebdriver.rb +57 -57
- data/lib/webdrivers/selenium.rb +29 -29
- data/spec/chromedriver_spec.rb +77 -75
- data/spec/geckodriver_spec.rb +62 -62
- data/spec/iedriver_spec.rb +38 -38
- data/spec/mswebdriver_spec.rb +26 -26
- data/spec/proxy_support_spec.rb +44 -44
- data/spec/spec_helper.rb +2 -2
- data/webdrivers.gemspec +27 -26
- metadata +12 -17
data/lib/webdrivers/selenium.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
require 'selenium-webdriver'
|
2
|
-
|
3
|
-
module Selenium
|
4
|
-
module WebDriver
|
5
|
-
module Chrome
|
6
|
-
def self.driver_path
|
7
|
-
@driver_path ||= Webdrivers::Chromedriver.update
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
module Firefox
|
12
|
-
def self.driver_path
|
13
|
-
@driver_path ||= Webdrivers::Geckodriver.update
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
module Edge
|
18
|
-
def self.driver_path
|
19
|
-
@driver_path ||= Webdrivers::MSWebdriver.update
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
module IE
|
24
|
-
def self.driver_path
|
25
|
-
@driver_path ||= Webdrivers::IEdriver.update
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
require 'selenium-webdriver'
|
2
|
+
|
3
|
+
module Selenium
|
4
|
+
module WebDriver
|
5
|
+
module Chrome
|
6
|
+
def self.driver_path
|
7
|
+
@driver_path ||= Webdrivers::Chromedriver.update
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Firefox
|
12
|
+
def self.driver_path
|
13
|
+
@driver_path ||= Webdrivers::Geckodriver.update
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module Edge
|
18
|
+
def self.driver_path
|
19
|
+
@driver_path ||= Webdrivers::MSWebdriver.update
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module IE
|
24
|
+
def self.driver_path
|
25
|
+
@driver_path ||= Webdrivers::IEdriver.update
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/chromedriver_spec.rb
CHANGED
@@ -1,75 +1,77 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Webdrivers::Chromedriver do
|
4
|
-
|
5
|
-
let(:chromedriver) { Webdrivers::Chromedriver }
|
6
|
-
|
7
|
-
it 'updates' do
|
8
|
-
chromedriver.update
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'parses chromedriver versions before 2.10' do
|
12
|
-
expect(chromedriver.send(:normalize, '2.9').version).to eq '2.9'
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'finds latest version' do
|
16
|
-
old_version = Gem::Version.new(
|
17
|
-
future_version = Gem::Version.new(
|
18
|
-
latest_version = chromedriver.latest_version
|
19
|
-
|
20
|
-
expect(latest_version).to be > old_version
|
21
|
-
expect(latest_version).to be < future_version
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'downloads latest version by default' do
|
25
|
-
chromedriver.remove
|
26
|
-
chromedriver.download
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
chromedriver.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
chromedriver.
|
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
|
-
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Webdrivers::Chromedriver do
|
4
|
+
|
5
|
+
let(:chromedriver) { Webdrivers::Chromedriver }
|
6
|
+
|
7
|
+
it 'updates' do
|
8
|
+
chromedriver.update
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'parses chromedriver versions before 2.10' do
|
12
|
+
expect(chromedriver.send(:normalize, '2.9').version).to eq '2.9'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'finds latest version' do
|
16
|
+
old_version = Gem::Version.new('2.30')
|
17
|
+
future_version = Gem::Version.new('80.00')
|
18
|
+
latest_version = chromedriver.latest_version
|
19
|
+
|
20
|
+
expect(latest_version).to be > old_version
|
21
|
+
expect(latest_version).to be < future_version
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'downloads latest release for current version of Chrome by default' do
|
25
|
+
chromedriver.remove
|
26
|
+
chromedriver.download
|
27
|
+
cur_ver = chromedriver.current_version.version
|
28
|
+
latest_ver = chromedriver.latest_version.version[0..3] # "72.0.3626.69" - > "72.0"
|
29
|
+
expect(cur_ver).to eq latest_ver
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'downloads specified version by Float' do
|
33
|
+
chromedriver.remove
|
34
|
+
chromedriver.version = 2.29
|
35
|
+
chromedriver.download
|
36
|
+
expect(chromedriver.current_version.version).to eq '2.29'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'downloads specified version by String' do
|
40
|
+
chromedriver.remove
|
41
|
+
chromedriver.version = '74.0.3729.6'
|
42
|
+
chromedriver.download
|
43
|
+
expect(chromedriver.current_version.version).to eq '74.0'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'removes chromedriver' do
|
47
|
+
chromedriver.remove
|
48
|
+
expect(chromedriver.current_version).to be_nil
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when offline' do
|
52
|
+
before { allow(chromedriver).to receive(:site_available?).and_return(false) }
|
53
|
+
|
54
|
+
it 'raises exception finding latest version' do
|
55
|
+
expect {chromedriver.latest_version}.to raise_error(StandardError, "Can not reach site")
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'raises exception downloading' do
|
59
|
+
expect {chromedriver.download}.to raise_error(StandardError, "Can not reach site")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'allows setting of install directory' do
|
64
|
+
begin
|
65
|
+
install_dir = File.expand_path(File.join(ENV['HOME'], ".webdrivers2"))
|
66
|
+
Webdrivers.install_dir = install_dir
|
67
|
+
expect(chromedriver.install_dir).to eq install_dir
|
68
|
+
ensure
|
69
|
+
Webdrivers.install_dir = nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'returns full location of binary' do
|
74
|
+
install_dir = File.expand_path(File.join(ENV['HOME'], ".webdrivers"))
|
75
|
+
expect(chromedriver.binary).to match /#{install_dir}\/chromedriver/
|
76
|
+
end
|
77
|
+
end
|
data/spec/geckodriver_spec.rb
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Webdrivers::Geckodriver do
|
4
|
-
|
5
|
-
let(:geckodriver) { Webdrivers::Geckodriver }
|
6
|
-
|
7
|
-
it 'raises exception if unable to get latest geckodriver and no geckodriver present' do
|
8
|
-
geckodriver.remove
|
9
|
-
allow(geckodriver).to receive(:desired_version).and_return(nil)
|
10
|
-
msg = /^Unable to find the latest version of geckodriver(.exe)?; try downloading manually from (.*)?and place in (.*)?\.webdrivers$/
|
11
|
-
expect { geckodriver.update }.to raise_exception StandardError, msg
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'uses found version of geckodriver if latest release unable to be found' do
|
15
|
-
geckodriver.download
|
16
|
-
allow(geckodriver).to receive(:desired_version).and_return(nil)
|
17
|
-
expect(geckodriver.update).to match(/\.webdrivers\/geckodriver/)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'finds latest version' do
|
21
|
-
old_version = Gem::Version.new('0.17')
|
22
|
-
future_version = Gem::Version.new('0.30')
|
23
|
-
desired_version = geckodriver.desired_version
|
24
|
-
|
25
|
-
expect(desired_version).to be > old_version
|
26
|
-
expect(desired_version).to be < future_version
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'downloads latest version by default' do
|
30
|
-
geckodriver.download
|
31
|
-
expect(geckodriver.current_version).to eq geckodriver.desired_version
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'downloads specified version' do
|
35
|
-
begin
|
36
|
-
geckodriver.remove
|
37
|
-
geckodriver.version = '0.17.0'
|
38
|
-
geckodriver.download
|
39
|
-
expect(geckodriver.current_version.version).to eq '0.17.0'
|
40
|
-
ensure
|
41
|
-
geckodriver.version = nil
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'removes geckodriver' do
|
46
|
-
geckodriver.remove
|
47
|
-
expect(geckodriver.current_version).to be_nil
|
48
|
-
end
|
49
|
-
|
50
|
-
context 'when offline' do
|
51
|
-
before { allow(geckodriver).to receive(:site_available?).and_return(false) }
|
52
|
-
|
53
|
-
it 'raises exception finding latest version' do
|
54
|
-
expect { geckodriver.desired_version }.to raise_error(StandardError, "Can not reach site")
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'raises exception downloading' do
|
58
|
-
expect { geckodriver.download }.to raise_error(StandardError, "Can not reach site")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Webdrivers::Geckodriver do
|
4
|
+
|
5
|
+
let(:geckodriver) { Webdrivers::Geckodriver }
|
6
|
+
|
7
|
+
it 'raises exception if unable to get latest geckodriver and no geckodriver present' do
|
8
|
+
geckodriver.remove
|
9
|
+
allow(geckodriver).to receive(:desired_version).and_return(nil)
|
10
|
+
msg = /^Unable to find the latest version of geckodriver(.exe)?; try downloading manually from (.*)?and place in (.*)?\.webdrivers$/
|
11
|
+
expect { geckodriver.update }.to raise_exception StandardError, msg
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'uses found version of geckodriver if latest release unable to be found' do
|
15
|
+
geckodriver.download
|
16
|
+
allow(geckodriver).to receive(:desired_version).and_return(nil)
|
17
|
+
expect(geckodriver.update).to match(/\.webdrivers\/geckodriver/)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'finds latest version' do
|
21
|
+
old_version = Gem::Version.new('0.17')
|
22
|
+
future_version = Gem::Version.new('0.30')
|
23
|
+
desired_version = geckodriver.desired_version
|
24
|
+
|
25
|
+
expect(desired_version).to be > old_version
|
26
|
+
expect(desired_version).to be < future_version
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'downloads latest version by default' do
|
30
|
+
geckodriver.download
|
31
|
+
expect(geckodriver.current_version).to eq geckodriver.desired_version
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'downloads specified version' do
|
35
|
+
begin
|
36
|
+
geckodriver.remove
|
37
|
+
geckodriver.version = '0.17.0'
|
38
|
+
geckodriver.download
|
39
|
+
expect(geckodriver.current_version.version).to eq '0.17.0'
|
40
|
+
ensure
|
41
|
+
geckodriver.version = nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'removes geckodriver' do
|
46
|
+
geckodriver.remove
|
47
|
+
expect(geckodriver.current_version).to be_nil
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when offline' do
|
51
|
+
before { allow(geckodriver).to receive(:site_available?).and_return(false) }
|
52
|
+
|
53
|
+
it 'raises exception finding latest version' do
|
54
|
+
expect { geckodriver.desired_version }.to raise_error(StandardError, "Can not reach site")
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'raises exception downloading' do
|
58
|
+
expect { geckodriver.download }.to raise_error(StandardError, "Can not reach site")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
data/spec/iedriver_spec.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Webdrivers::IEdriver do
|
4
|
-
|
5
|
-
let(:iedriver) { Webdrivers::IEdriver }
|
6
|
-
|
7
|
-
it 'finds latest version' do
|
8
|
-
old_version = Gem::Version.new("3.12.0")
|
9
|
-
future_version = Gem::Version.new("4.0")
|
10
|
-
desired_version = iedriver.desired_version
|
11
|
-
|
12
|
-
expect(desired_version).to be > old_version
|
13
|
-
expect(desired_version).to be < future_version
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'downloads iedriver' do
|
17
|
-
iedriver.remove
|
18
|
-
expect(File.exist?(iedriver.download)).to be true
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'removes iedriver' do
|
22
|
-
iedriver.remove
|
23
|
-
expect(iedriver.current_version).to be_nil
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when offline' do
|
27
|
-
before { allow(iedriver).to receive(:site_available?).and_return(false) }
|
28
|
-
|
29
|
-
it 'raises exception finding latest version' do
|
30
|
-
expect {iedriver.latest_version}.to raise_error(StandardError, "Can not reach site")
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'raises exception downloading' do
|
34
|
-
expect {iedriver.download}.to raise_error(StandardError, "Can not reach site")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Webdrivers::IEdriver do
|
4
|
+
|
5
|
+
let(:iedriver) { Webdrivers::IEdriver }
|
6
|
+
|
7
|
+
it 'finds latest version' do
|
8
|
+
old_version = Gem::Version.new("3.12.0")
|
9
|
+
future_version = Gem::Version.new("4.0")
|
10
|
+
desired_version = iedriver.desired_version
|
11
|
+
|
12
|
+
expect(desired_version).to be > old_version
|
13
|
+
expect(desired_version).to be < future_version
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'downloads iedriver' do
|
17
|
+
iedriver.remove
|
18
|
+
expect(File.exist?(iedriver.download)).to be true
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'removes iedriver' do
|
22
|
+
iedriver.remove
|
23
|
+
expect(iedriver.current_version).to be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'when offline' do
|
27
|
+
before { allow(iedriver).to receive(:site_available?).and_return(false) }
|
28
|
+
|
29
|
+
it 'raises exception finding latest version' do
|
30
|
+
expect {iedriver.latest_version}.to raise_error(StandardError, "Can not reach site")
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'raises exception downloading' do
|
34
|
+
expect {iedriver.download}.to raise_error(StandardError, "Can not reach site")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/spec/mswebdriver_spec.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Webdrivers::MSWebdriver do
|
4
|
-
|
5
|
-
let(:mswebdriver) { Webdrivers::MSWebdriver }
|
6
|
-
|
7
|
-
it 'downloads mswebdriver' do
|
8
|
-
mswebdriver.remove
|
9
|
-
allow(mswebdriver).to receive(:desired_version).and_return(mswebdriver.latest_version)
|
10
|
-
expect(File.exist?(mswebdriver.download)).to be true
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'removes mswebdriver' do
|
14
|
-
mswebdriver.remove
|
15
|
-
expect(File.exist?(mswebdriver.send :binary)).to be false
|
16
|
-
end
|
17
|
-
|
18
|
-
context 'when offline' do
|
19
|
-
before { allow(mswebdriver).to receive(:site_available?).and_return(false) }
|
20
|
-
|
21
|
-
it 'raises exception downloading' do
|
22
|
-
expect { mswebdriver.download }.to raise_error(StandardError, "Can not reach site")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Webdrivers::MSWebdriver do
|
4
|
+
|
5
|
+
let(:mswebdriver) { Webdrivers::MSWebdriver }
|
6
|
+
|
7
|
+
it 'downloads mswebdriver' do
|
8
|
+
mswebdriver.remove
|
9
|
+
allow(mswebdriver).to receive(:desired_version).and_return(mswebdriver.latest_version)
|
10
|
+
expect(File.exist?(mswebdriver.download)).to be true
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'removes mswebdriver' do
|
14
|
+
mswebdriver.remove
|
15
|
+
expect(File.exist?(mswebdriver.send :binary)).to be false
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when offline' do
|
19
|
+
before { allow(mswebdriver).to receive(:site_available?).and_return(false) }
|
20
|
+
|
21
|
+
it 'raises exception downloading' do
|
22
|
+
expect { mswebdriver.download }.to raise_error(StandardError, "Can not reach site")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|