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

Function chrome

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

Source from the content-addressed store, hash-verified

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

Callers 1

pinned_browsers.pyFile · 0.85

Calls 1

calculate_hashFunction · 0.85

Tested by

no test coverage detected