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

Function chrome

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

Source from the content-addressed store, hash-verified

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

Callers 1

pinned_browsers.pyFile · 0.85

Calls 1

calculate_hashFunction · 0.85

Tested by

no test coverage detected