Created
June 4, 2024 02:24
-
-
Save perryism/553b8317bf57f83f1047d6a444962118 to your computer and use it in GitHub Desktop.
get matching chrome driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
import os | |
import urllib.request | |
match = sys.argv[1] | |
filepath = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"#sys.argv[2] | |
def get_versions(filepath): | |
if os.path.exists(filepath): | |
with open(filepath, "r") as f: | |
return json.loads(f.read()) | |
else: | |
with urllib.request.urlopen(filepath) as response: | |
return json.loads(response.read()) | |
content = get_versions(filepath) | |
for version in content["versions"]: | |
if match in version["version"]: | |
for f in filter(lambda x: x["platform"] == "win64", version["downloads"]["chromedriver"]): | |
print(f["url"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment