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

Function chrome

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

Source from the content-addressed store, hash-verified

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

Callers 1

pinned_browsers.pyFile · 0.85

Calls 1

calculate_hashFunction · 0.85

Tested by

no test coverage detected