browsertest

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 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 browsertest is a fake DevTools page, to test code driving a browser without one: it answers the commands package browser sends as a simple page would, and records them.

Index

Constants

View Source
const Title = "Fake page"

Title is every page's title.

Variables

View Source
var PNG = []byte("\x89PNG\r\n\x1a\nfake")

PNG is the screenshot the fake takes: a PNG signature and nothing more.

Functions

This section is empty.

Types

type Page

type Page struct {
	// URL is the DevTools WebSocket address to Attach to.
	URL string
	// contains filtered or unexported fields
}

Page is a fake page. Navigating sends a main-frame document request through Fetch.requestPaused and, as Chrome does, answers only once the browser decides: continued, it loads Title at the URL; failed, the navigation's answer is its error and nothing loads. Away is a link going to another URL.

func New

func New(t testing.TB) *Page

New starts a fake page, closed with the test.

func (*Page) Decided

func (p *Page) Decided() map[string]string

Decided is what the browser decided about each page load: "continue" or "fail", by URL.

func (*Page) Methods

func (p *Page) Methods() []string

Methods are the commands received so far.

Jump to

Keyboard shortcuts

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