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

Function chrome

scripts/pinned_browsers.py:105–166  ·  view source on GitHub ↗
(selected_version, workspace_prefix="")

Source from the content-addressed store, hash-verified

103
104
105def chrome(selected_version, workspace_prefix=""):
106 content = ""
107 chrome_downloads = selected_version["downloads"]["chrome"]
108
109 url = next((d["url"] for d in chrome_downloads if d["platform"] == "linux64"), None)
110 if url is None:
111 raise ValueError("No Chrome download found for platform 'linux64'")
112 sha = calculate_hash(url)
113
114 content += f"""
115 http_archive(
116 name = "linux_{workspace_prefix}chrome",
117 url = "{url}",
118 sha256 = "{sha}",
119 build_file_content = \"\"\"
120load("@aspect_rules_js//js:defs.bzl", "js_library")
121package(default_visibility = ["//visibility:public"])
122
123filegroup(
124 name = "files",
125 srcs = glob(["**/*"]),
126)
127
128exports_files(["chrome-linux64/chrome"])
129
130js_library(
131 name = "chrome-js",
132 data = [":files"],
133)
134\"\"\",
135 )
136"""
137
138 url = next((d["url"] for d in chrome_downloads if d["platform"] == "mac-arm64"), None)
139 if url is None:
140 raise ValueError("No Chrome download found for platform 'mac-arm64'")
141 sha = calculate_hash(url) # Calculate SHA for Mac chrome
142
143 content += f""" http_archive(
144 name = "mac_{workspace_prefix}chrome",
145 url = "{url}",
146 sha256 = "{sha}",
147 strip_prefix = "chrome-mac-arm64",
148 patch_cmds = [
149 "mv 'Google Chrome for Testing.app' Chrome.app",
150 "mv 'Chrome.app/Contents/MacOS/Google Chrome for Testing' Chrome.app/Contents/MacOS/Chrome",
151 ],
152 build_file_content = \"\"\"
153load("@aspect_rules_js//js:defs.bzl", "js_library")
154package(default_visibility = ["//visibility:public"])
155
156exports_files(["Chrome.app"])
157
158js_library(
159 name = "chrome-js",
160 data = glob(["Chrome.app/**/*"]),
161)
162\"\"\",

Callers 1

pinned_browsers.pyFile · 0.85

Calls 1

calculate_hashFunction · 0.85

Tested by

no test coverage detected