Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/selector-benchmark-harness.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233import { rootPath } from "./paths.ts";import { type Browser, chromium, type Page } from "playwright-core";
export async function launchChromium(): Promise<Browser> { const executablePath = Deno.env.get("CHROMIUM_PATH") ?? findChromiumExecutable(); return await chromium.launch({ executablePath, headless: true, args: ["--no-sandbox", "--disable-dev-shm-usage"], });}
export async function installSelectorProbe(page: Page): Promise<void> { await page.addScriptTag({ path: rootPath("dist", "selector_probe.iife.js") });}
function findChromiumExecutable(): string { const candidates = [ "/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome", "/usr/bin/google-chrome-stable", ]; for (const candidate of candidates) { try { if (Deno.statSync(candidate).isFile) return candidate; } catch { // Keep looking. The explicit error is raised below with the supported override. } } throw new Error("Chromium was not found. Set CHROMIUM_PATH to a Chromium-compatible executable.");}