browserprobe

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package browserprobe smoke-tests a browser binary by actually launching it headless, rather than trusting a `--version` string.

A `--version` check (or a bare PATH lookup) only proves the file exists and can print a banner. It does NOT prove the browser can render: some distro Chromium builds print a version but then SIGTRAP during real headless startup (observed with Debian's Chromium 150 on a KVM guest), and a downloaded Chrome can be missing a runtime shared library. Those failures only surface when a scan tries to spider, long after `doctor` reported the browser green. Launchable() closes that gap by performing the same remote-debugging handshake the spider relies on.

Index

Constants

View Source
const DefaultTimeout = 30 * time.Second

DefaultTimeout bounds a single launch probe. A healthy browser exposes its DevTools endpoint in ~1-2s; a broken one dies almost immediately. The cap only matters for a binary that hangs without ever crashing or serving.

Variables

This section is empty.

Functions

func FirstLine

func FirstLine(s string) string

FirstLine returns the first non-empty line of s, trimmed. go-rod's launch error embeds the browser's multi-line stderr (often led by benign crashpad cpufreq noise); the first line — "launcher Failed to get the debug url: ..." — is the actionable part and keeps doctor/log output readable.

func Launchable

func Launchable(binPath string) error

Launchable reports whether the browser binary at binPath can actually start headless and expose a DevTools endpoint. It returns nil when the browser came up, or a trimmed error describing why it did not. It launches a throwaway headless instance in an isolated, self-cleaning user-data dir with the same critical flags the spider uses (--no-sandbox, --disable-dev-shm-usage), waits for the DevTools URL, then kills the process. Bounded by DefaultTimeout.

The remote-debugging handshake — not `--dump-dom` or `--version` — is the reliable discriminator: a working Chrome for Testing can hang on --dump-dom in a minimal VM (blocked on dbus/UPower) while still serving DevTools instantly, whereas a genuinely broken Chromium never serves at all.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL