Skip to content

Commit 3f75b69

Browse files
committed
Update the script that downloads chromedriver
1 parent 079a2e0 commit 3f75b69

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

console_scripts/sb_install.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import os
1717
import platform
18-
# import requests
18+
import requests
1919
import shutil
2020
import sys
2121
import tarfile
@@ -82,21 +82,23 @@ def main():
8282
else:
8383
raise Exception("Cannot determine which version of Chromedriver "
8484
"to download!")
85-
86-
# latest_version = requests.get(
87-
# "http://chromedriver.storage.googleapis.com/LATEST_RELEASE").text
88-
#
89-
# ### Chromedriver 2.41 / latest may have issues. Forcing 2.40 for now.
9085
latest_version = "2.40"
9186
download_url = ("http://chromedriver.storage.googleapis.com/"
9287
"%s/%s" % (latest_version, file_name))
93-
#print('\nLocating the latest version of Chromedriver...')
94-
#if not requests.get(download_url).ok:
95-
# # If there's a problem with the latest Chromedriver, fall back
96-
# fallback_version = "2.40"
97-
# download_url = ("http://chromedriver.storage.googleapis.com/"
98-
# "%s/%s" % (fallback_version, file_name))
99-
#print("Found %s" % download_url)
88+
# Chromedriver 2.41 (latest) may have issues. Forcing 2.40 for now.
89+
get_latest = False
90+
if get_latest:
91+
last = "http://chromedriver.storage.googleapis.com/LATEST_RELEASE"
92+
print('\nLocating the latest version of Chromedriver...')
93+
latest_version = requests.get(last).text
94+
if not requests.get(download_url).ok:
95+
fallback_version = "2.40"
96+
download_url = ("http://chromedriver.storage.googleapis.com/"
97+
"%s/%s" % (fallback_version, file_name))
98+
else:
99+
download_url = ("http://chromedriver.storage.googleapis.com/"
100+
"%s/%s" % (latest_version, file_name))
101+
print("Found %s" % download_url)
100102
elif name == "geckodriver" or name == "firefoxdriver":
101103
latest_version = "v0.21.0"
102104
if "darwin" in sys_plat:

0 commit comments

Comments
 (0)