browser

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package browser — multi-backend browser automation engine. Backends: chrome (built-in), playwright (plugin). The builtin browser.go delegates here for extensibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() []string

List returns all registered backend names.

func Register

func Register(name string, f Factory)

Register adds a backend factory. Called from init().

Types

type Browser

type Browser interface {
	// Name returns the backend name.
	Name() string
	// NewPage opens a new page/tab.
	NewPage(ctx context.Context) (Page, error)
	// Close shuts down the browser.
	Close() error
}

Browser opens and manages browser instances.

func Get

func Get(name, config string) Browser

Get returns a Browser by name, or nil.

type Factory

type Factory func(config string) (Browser, error)

Factory creates a Browser from a config string.

type Page

type Page interface {
	Navigate(ctx context.Context, url string) error
	Screenshot(ctx context.Context) ([]byte, error)
	Text(ctx context.Context) (string, error)
	Click(ctx context.Context, selector string) error
	Type(ctx context.Context, selector, value string) error
	Eval(ctx context.Context, js string) (string, error)
	Close() error
}

Page represents a browser page/tab.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all registered browser backends.

Jump to

Keyboard shortcuts

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