launcher

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package launcher provides Chrome browser discovery, launching, and lifecycle management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindChrome

func FindChrome(chromePath string) string

FindChrome locates Chrome on the system. If chromePath is non-empty and exists, it is returned directly. Otherwise, searches PATH and known install locations.

func IsPortOpen

func IsPortOpen(host string, port int) bool

IsPortOpen checks if a TCP port is accepting connections.

func WaitForPort

func WaitForPort(host string, port int, timeout time.Duration) error

WaitForPort waits for a TCP port to become available.

Types

type ChromeInfo

type ChromeInfo struct {
	Browser  string `json:"Browser"`
	Protocol string `json:"Protocol-Version"`
	V8       string `json:"V8-Version"`
	WebKit   string `json:"WebKit-Version"`
}

ChromeInfo contains version information from a running Chrome instance.

func DetectRunning

func DetectRunning(host string, port int) (*ChromeInfo, error)

DetectRunning checks if a Chrome debug port is responding and returns version info.

type Instance

type Instance struct {
	Port    int
	PID     int
	DataDir string
	// contains filtered or unexported fields
}

Instance represents a running Chrome instance.

func Launch

func Launch(opts LaunchOptions) (*Instance, error)

Launch starts a Chrome instance with the given options.

func (*Instance) Stop

func (inst *Instance) Stop() error

Stop terminates the Chrome instance and cleans up.

type LaunchOptions

type LaunchOptions struct {
	ChromePath string // Path to Chrome binary (auto-detected if empty)
	Port       int    // Remote debugging port
	Headless   bool   // Run in headless mode
	DataDir    string // User data directory (temp dir created if empty)
}

LaunchOptions configures Chrome launching.

Jump to

Keyboard shortcuts

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