MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / get_chrome_milestone

Function get_chrome_milestone

scripts/update_cdp.py:17–47  ·  view source on GitHub ↗

Get the Chrome milestone from the channel. This is the same method from pinned_browser. Use --chrome_channel=Beta if using early stable release.

()

Source from the content-addressed store, hash-verified

15
16
17def get_chrome_milestone():
18 """Get the Chrome milestone from the channel.
19
20 This is the same method from pinned_browser. Use --chrome_channel=Beta if
21 using early stable release.
22 """
23 parser = argparse.ArgumentParser()
24 parser.add_argument("--chrome_channel", default="Stable", help="Set the Chrome channel")
25 args = parser.parse_args()
26 channel = args.chrome_channel
27
28 r = http.request(
29 "GET",
30 f"https://chromiumdash.appspot.com/fetch_releases?channel={channel}&num=1&platform=Mac,Linux",
31 )
32 all_versions = json.loads(r.data)
33 # use the same milestone for all Chrome releases, so pick the lowest
34 milestones = [version["milestone"] for version in all_versions if version["milestone"]]
35 if not milestones:
36 raise ValueError(f"No Chrome versions with milestones found for channel '{channel}'")
37 milestone = min(milestones)
38 r = http.request(
39 "GET",
40 "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json",
41 )
42 versions = json.loads(r.data)["versions"]
43
44 return sorted(
45 filter(lambda v: v["version"].split(".")[0] == str(milestone), versions),
46 key=lambda v: parse(v["version"]),
47 )[-1]
48
49
50def fetch_and_save(url, file_path):

Callers 1

update_cdp.pyFile · 0.85

Calls 5

add_argumentMethod · 0.80
splitMethod · 0.80
filterFunction · 0.50
parseFunction · 0.50
requestMethod · 0.45

Tested by

no test coverage detected