Skip to content

Instantly share code, notes, and snippets.

@perryism
Created June 4, 2024 02:24
Show Gist options
  • Save perryism/553b8317bf57f83f1047d6a444962118 to your computer and use it in GitHub Desktop.
Save perryism/553b8317bf57f83f1047d6a444962118 to your computer and use it in GitHub Desktop.
get matching chrome driver
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