|
1 | 1 | """
|
2 | 2 | This script installs the chromedriver version that matches your Chrome.
|
3 | 3 | On newer versions of Python, you may replace "testdir" with "pytester".
|
4 |
| -(Run with "pytest") / (For Linux/macOS systems only!) |
| 4 | +(Run with "pytest") |
5 | 5 | """
|
6 | 6 | import subprocess
|
7 |
| -import sys |
8 | 7 |
|
9 | 8 |
|
10 | 9 | class TestUpgradeChromedriver:
|
@@ -80,22 +79,20 @@ def test_print_versions(self):
|
80 | 79 | return testdir
|
81 | 80 |
|
82 | 81 | def test_upgrade_chromedriver(self, testdir):
|
83 |
| - if "linux" not in sys.platform and "darwin" not in sys.platform: |
84 |
| - print("\n This script is for Linux/macOS systems only!") |
85 |
| - self.skip("This script is for Linux/macOS systems only!") |
86 | 82 | # Find out if the installed chromedriver version works with Chrome
|
| 83 | + subprocess.check_call( |
| 84 | + "seleniumbase get chromedriver latest", shell=True |
| 85 | + ) |
87 | 86 | testdir = self.basic_run(testdir)
|
88 |
| - result = testdir.inline_run("--headless") |
| 87 | + result = testdir.inline_run("--headless", "-s") # Upgrades as needed |
89 | 88 | try:
|
90 | 89 | assert result.matchreport("test_passing").passed
|
91 | 90 | except Exception:
|
92 | 91 | # Install the compatibility version of chromedriver
|
93 |
| - subprocess.check_call( |
94 |
| - "seleniumbase get chromedriver 72.0.3626.69", shell=True |
95 |
| - ) |
96 |
| - # Upgrade chromedriver to match the installed version of Chrome |
97 |
| - testdir = self.upgrade_chromedriver(testdir) |
98 |
| - result = testdir.inline_run("--headless", "-s") |
| 92 | + install_command = "seleniumbase get chromedriver 72.0.3626.69" |
| 93 | + subprocess.check_call(install_command, shell=True) |
| 94 | + testdir = self.upgrade_chromedriver(testdir) |
| 95 | + testdir.inline_run("--headless", "-s") |
99 | 96 | # Print the final installed versions of chromedriver and Chrome
|
100 | 97 | testdir = self.print_versions_of_chromedriver_and_chrome(testdir)
|
101 |
| - result = testdir.inline_run("--headless", "-s") |
| 98 | + testdir.inline_run("--headless", "-s") |
0 commit comments