Versions in this module Expand all Collapse all v0 v0.5.0 Mar 23, 2026 Changes in this version + const DefaultTimeout + var Browser = &browserLauncher + var ErrBrowserCrashed = errors.New("browser crashed") + var ErrBrowserNotFound = errors.New("Chrome not found") + var ErrClickerNotFound = ErrBrowserNotFound + var ErrConnectionClosed = errors.New("connection closed") + var ErrConnectionFailed = errors.New("failed to connect to browser") + var ErrElementNotFound = errors.New("element not found") + var ErrTimeout = errors.New("operation timed out") + func ContextWithLogger(ctx context.Context, logger *slog.Logger) context.Context + func Debug() bool + func LoggerFromContext(ctx context.Context) *slog.Logger + func NewDebugLogger() *slog.Logger + type A11yTreeOptions struct + InterestingOnly *bool + Root string + type ActionOptions struct + Timeout time.Duration + type BiDiClient struct + func NewBiDiClient() *BiDiClient + func (c *BiDiClient) Close() error + func (c *BiDiClient) Connect(ctx context.Context, url string) error + func (c *BiDiClient) OnEvent(method string, handler EventHandler) + func (c *BiDiClient) RemoveEventHandlers(method string) + func (c *BiDiClient) Send(ctx context.Context, method string, params interface{}) (json.RawMessage, error) + type BiDiCommand struct + ID int64 + Method string + Params interface{} + type BiDiError struct + ErrorType string + Message string + func (e *BiDiError) Error() string + type BiDiEvent struct + Method string + Params json.RawMessage + type BiDiResponse struct + Error string + ID int64 + Message string + Method string + Params json.RawMessage + Result json.RawMessage + Type string + type BoundingBox struct + Height float64 + Width float64 + X float64 + Y float64 + type BrowserContext struct + func (c *BrowserContext) AddInitScript(ctx context.Context, script string) error + func (c *BrowserContext) ClearCookies(ctx context.Context) error + func (c *BrowserContext) ClearPermissions(ctx context.Context) error + func (c *BrowserContext) Close(ctx context.Context) error + func (c *BrowserContext) Cookies(ctx context.Context, urls ...string) ([]Cookie, error) + func (c *BrowserContext) DeleteCookie(ctx context.Context, name string, domain string, path string) error + func (c *BrowserContext) GrantPermissions(ctx context.Context, permissions []string, origin string) error + func (c *BrowserContext) NewPage(ctx context.Context) (*Pilot, error) + func (c *BrowserContext) SetCookies(ctx context.Context, cookies []SetCookieParam) error + func (c *BrowserContext) StorageState(ctx context.Context) (*StorageState, error) + func (c *BrowserContext) Tracing() *Tracing + type BrowserCrashedError struct + ExitCode int + Output string + func (e *BrowserCrashedError) Error() string + type ClickOptions struct + Button MouseButton + ClickCount int + Delay int + type Clock struct + func NewClock(client *BiDiClient, browsingContext string) *Clock + func (c *Clock) FastForward(ctx context.Context, ticks int64) error + func (c *Clock) Install(ctx context.Context, opts *ClockInstallOptions) error + func (c *Clock) PauseAt(ctx context.Context, t interface{}) error + func (c *Clock) Resume(ctx context.Context) error + func (c *Clock) RunFor(ctx context.Context, ticks int64) error + func (c *Clock) SetFixedTime(ctx context.Context, t interface{}) error + func (c *Clock) SetSystemTime(ctx context.Context, t interface{}) error + func (c *Clock) SetTimezone(ctx context.Context, tz string) error + type ClockInstallOptions struct + Time interface{} + type ConnectionError struct + Cause error + URL string + func (e *ConnectionError) Error() string + func (e *ConnectionError) Unwrap() error + type ConsoleHandler func(*ConsoleMessage) + type ConsoleMessage struct + Args []string + Line int + Text string + Type string + URL string + type ContinueOptions struct + Headers map[string]string + Method string + PostData string + URL string + type Cookie struct + Domain string + Expires float64 + HTTPOnly bool + Name string + PartitionKey string + Path string + SameSite string + Secure bool + Value string + type Dialog struct + Default string + Message string + Type string + func (d *Dialog) Accept(ctx context.Context, promptText string) error + func (d *Dialog) Dismiss(ctx context.Context) error + type DialogHandler func(*Dialog) + type DialogInfo struct + DefaultValue string + HasDialog bool + Message string + Type string + type Download struct + Name string + URL string + func (d *Download) Cancel(ctx context.Context) error + func (d *Download) Failure(ctx context.Context) (string, error) + func (d *Download) Path(ctx context.Context) (string, error) + func (d *Download) SaveAs(ctx context.Context, path string) error + type DownloadHandler func(*Download) + type Element struct + func NewElement(client *BiDiClient, browsingContext, selector string, info ElementInfo) *Element + func (e *Element) BoundingBox(ctx context.Context) (BoundingBox, error) + func (e *Element) Center() (x, y float64) + func (e *Element) Check(ctx context.Context, opts *ActionOptions) error + func (e *Element) Clear(ctx context.Context, opts *ActionOptions) error + func (e *Element) Click(ctx context.Context, opts *ActionOptions) error + func (e *Element) DblClick(ctx context.Context, opts *ActionOptions) error + func (e *Element) DispatchEvent(ctx context.Context, eventType string, eventInit map[string]interface{}) error + func (e *Element) DragTo(ctx context.Context, target *Element, opts *ActionOptions) error + func (e *Element) Eval(ctx context.Context, fn string, args ...interface{}) (interface{}, error) + func (e *Element) Fill(ctx context.Context, value string, opts *ActionOptions) error + func (e *Element) Find(ctx context.Context, selector string, opts *FindOptions) (*Element, error) + func (e *Element) FindAll(ctx context.Context, selector string, opts *FindOptions) ([]*Element, error) + func (e *Element) Focus(ctx context.Context, opts *ActionOptions) error + func (e *Element) GetAttribute(ctx context.Context, name string) (string, error) + func (e *Element) HTML(ctx context.Context) (string, error) + func (e *Element) Highlight(ctx context.Context, opts *HighlightOptions) error + func (e *Element) Hover(ctx context.Context, opts *ActionOptions) error + func (e *Element) Info() ElementInfo + func (e *Element) InnerHTML(ctx context.Context) (string, error) + func (e *Element) InnerText(ctx context.Context) (string, error) + func (e *Element) IsChecked(ctx context.Context) (bool, error) + func (e *Element) IsEditable(ctx context.Context) (bool, error) + func (e *Element) IsEnabled(ctx context.Context) (bool, error) + func (e *Element) IsHidden(ctx context.Context) (bool, error) + func (e *Element) IsVisible(ctx context.Context) (bool, error) + func (e *Element) Label(ctx context.Context) (string, error) + func (e *Element) Press(ctx context.Context, key string, opts *ActionOptions) error + func (e *Element) Role(ctx context.Context) (string, error) + func (e *Element) Screenshot(ctx context.Context) ([]byte, error) + func (e *Element) ScrollIntoView(ctx context.Context, opts *ActionOptions) error + func (e *Element) SelectOption(ctx context.Context, values SelectOptionValues, opts *ActionOptions) error + func (e *Element) Selector() string + func (e *Element) SetFiles(ctx context.Context, paths []string, opts *ActionOptions) error + func (e *Element) Tap(ctx context.Context, opts *ActionOptions) error + func (e *Element) Text(ctx context.Context) (string, error) + func (e *Element) Type(ctx context.Context, text string, opts *ActionOptions) error + func (e *Element) Uncheck(ctx context.Context, opts *ActionOptions) error + func (e *Element) Value(ctx context.Context) (string, error) + func (e *Element) WaitFor(ctx context.Context, timeout time.Duration) error + func (e *Element) WaitUntil(ctx context.Context, state string, timeout time.Duration) error + type ElementInfo struct + Box BoundingBox + Tag string + Text string + type ElementNotFoundError struct + Selector string + func (e *ElementNotFoundError) Error() string + type EmulateMediaOptions struct + ColorScheme string + Contrast string + ForcedColors string + Media string + ReducedMotion string + type EventHandler func(event *BiDiEvent) + type FindOptions struct + Alt string + Label string + Near string + Placeholder string + Role string + TestID string + Text string + Timeout time.Duration + Title string + XPath string + type FrameInfo struct + Name string + URL string + type FulfillOptions struct + Body []byte + ContentType string + Headers map[string]string + Path string + Status int + type Geolocation struct + Accuracy float64 + Latitude float64 + Longitude float64 + type HighlightOptions struct + Color string + Duration int + type Keyboard struct + func NewKeyboard(client *BiDiClient, browsingContext string) *Keyboard + func (k *Keyboard) Down(ctx context.Context, key string) error + func (k *Keyboard) InsertText(ctx context.Context, text string) error + func (k *Keyboard) Press(ctx context.Context, key string) error + func (k *Keyboard) Type(ctx context.Context, text string) error + func (k *Keyboard) Up(ctx context.Context, key string) error + type LaunchOptions struct + Args []string + AutoInstall *bool + ExecutablePath string + Headless bool + Port int + UserDataDir string + type MockRouteOptions struct + Body string + ContentType string + Headers map[string]string + Status int + type Mouse struct + func NewMouse(client *BiDiClient, browsingContext string) *Mouse + func (m *Mouse) Click(ctx context.Context, x, y float64, opts *ClickOptions) error + func (m *Mouse) DblClick(ctx context.Context, x, y float64, opts *ClickOptions) error + func (m *Mouse) Down(ctx context.Context, button MouseButton) error + func (m *Mouse) Move(ctx context.Context, x, y float64) error + func (m *Mouse) Up(ctx context.Context, button MouseButton) error + func (m *Mouse) Wheel(ctx context.Context, deltaX, deltaY float64) error + type MouseButton string + const MouseButtonLeft + const MouseButtonMiddle + const MouseButtonRight + type NetworkRequest struct + Headers map[string]string + Method string + PostData string + ResourceType string + ResponseSize int64 + Status int + StatusText string + Timestamp int64 + URL string + type NetworkRequestsOptions struct + Method string + ResourceType string + URLPattern string + type PDFMargin struct + Bottom string + Left string + Right string + Top string + type PDFOptions struct + DisplayFooter bool + DisplayHeader bool + Format string + Height string + Landscape bool + Margin *PDFMargin + PageRanges string + Path string + PrintBackground bool + Scale float64 + Width string + type PageError struct + Column int + Line int + Message string + Stack string + URL string + type PageErrorHandler func(*PageError) + type PageHandler func(*Pilot) + type Pilot struct + func Launch(ctx context.Context) (*Pilot, error) + func LaunchHeadless(ctx context.Context) (*Pilot, error) + func (p *Pilot) A11yTree(ctx context.Context, opts *A11yTreeOptions) (interface{}, error) + func (p *Pilot) AddInitScript(ctx context.Context, script string) error + func (p *Pilot) AddScript(ctx context.Context, source string) error + func (p *Pilot) AddStyle(ctx context.Context, source string) error + func (p *Pilot) Back(ctx context.Context) error + func (p *Pilot) BringToFront(ctx context.Context) error + func (p *Pilot) BrowserVersion(ctx context.Context) (string, error) + func (p *Pilot) BrowsingContext() string + func (p *Pilot) ClearConsoleMessages(ctx context.Context) error + func (p *Pilot) ClearErrors(ctx context.Context) error + func (p *Pilot) ClearNetworkRequests(ctx context.Context) error + func (p *Pilot) ClearStorage(ctx context.Context) error + func (p *Pilot) Clock(ctx context.Context) (*Clock, error) + func (p *Pilot) Close(ctx context.Context) error + func (p *Pilot) CollectConsole(ctx context.Context) error + func (p *Pilot) CollectErrors(ctx context.Context) error + func (p *Pilot) ConsoleMessages(ctx context.Context, level string) ([]ConsoleMessage, error) + func (p *Pilot) Content(ctx context.Context) (string, error) + func (p *Pilot) Context() *BrowserContext + func (p *Pilot) EmulateMedia(ctx context.Context, opts EmulateMediaOptions) error + func (p *Pilot) Errors(ctx context.Context) ([]PageError, error) + func (p *Pilot) Evaluate(ctx context.Context, script string) (interface{}, error) + func (p *Pilot) Expose(ctx context.Context, name string) error + func (p *Pilot) Find(ctx context.Context, selector string, opts *FindOptions) (*Element, error) + func (p *Pilot) FindAll(ctx context.Context, selector string, opts *FindOptions) ([]*Element, error) + func (p *Pilot) Forward(ctx context.Context) error + func (p *Pilot) Frame(ctx context.Context, nameOrURL string) (*Pilot, error) + func (p *Pilot) Frames(ctx context.Context) ([]FrameInfo, error) + func (p *Pilot) GetDialog(ctx context.Context) (DialogInfo, error) + func (p *Pilot) GetViewport(ctx context.Context) (Viewport, error) + func (p *Pilot) GetWindow(ctx context.Context) (WindowState, error) + func (p *Pilot) Go(ctx context.Context, url string) error + func (p *Pilot) HandleDialog(ctx context.Context, accept bool, promptText string) error + func (p *Pilot) IsClosed() bool + func (p *Pilot) Keyboard(ctx context.Context) (*Keyboard, error) + func (p *Pilot) ListRoutes(ctx context.Context) ([]RouteInfo, error) + func (p *Pilot) MainFrame() *Pilot + func (p *Pilot) MockRoute(ctx context.Context, pattern string, opts MockRouteOptions) error + func (p *Pilot) Mouse(ctx context.Context) (*Mouse, error) + func (p *Pilot) MustFind(ctx context.Context, selector string) *Element + func (p *Pilot) NetworkRequests(ctx context.Context, opts *NetworkRequestsOptions) ([]NetworkRequest, error) + func (p *Pilot) NewContext(ctx context.Context) (*BrowserContext, error) + func (p *Pilot) NewPage(ctx context.Context) (*Pilot, error) + func (p *Pilot) OnConsole(ctx context.Context, handler ConsoleHandler) error + func (p *Pilot) OnDialog(ctx context.Context, handler DialogHandler) error + func (p *Pilot) OnDownload(ctx context.Context, handler DownloadHandler) error + func (p *Pilot) OnError(ctx context.Context, handler PageErrorHandler) error + func (p *Pilot) OnPage(ctx context.Context, handler PageHandler) error + func (p *Pilot) OnPopup(ctx context.Context, handler PopupHandler) error + func (p *Pilot) OnRequest(ctx context.Context, handler RequestHandler) error + func (p *Pilot) OnResponse(ctx context.Context, handler ResponseHandler) error + func (p *Pilot) OnWebSocket(ctx context.Context, handler WebSocketHandler) error + func (p *Pilot) PDF(ctx context.Context, opts *PDFOptions) ([]byte, error) + func (p *Pilot) Pages(ctx context.Context) ([]*Pilot, error) + func (p *Pilot) Quit(ctx context.Context) error + func (p *Pilot) Reload(ctx context.Context) error + func (p *Pilot) RemoveAllListeners() + func (p *Pilot) Route(ctx context.Context, pattern string, handler RouteHandler) error + func (p *Pilot) Screenshot(ctx context.Context) ([]byte, error) + func (p *Pilot) Scroll(ctx context.Context, direction string, amount int, opts *ScrollOptions) error + func (p *Pilot) SetContent(ctx context.Context, html string) error + func (p *Pilot) SetExtraHTTPHeaders(ctx context.Context, headers map[string]string) error + func (p *Pilot) SetGeolocation(ctx context.Context, coords Geolocation) error + func (p *Pilot) SetOffline(ctx context.Context, offline bool) error + func (p *Pilot) SetStorageState(ctx context.Context, state *StorageState) error + func (p *Pilot) SetViewport(ctx context.Context, viewport Viewport) error + func (p *Pilot) SetWindow(ctx context.Context, opts SetWindowOptions) error + func (p *Pilot) StartVideo(ctx context.Context, opts *VideoOptions) (*Video, error) + func (p *Pilot) StopVideo(ctx context.Context) (string, error) + func (p *Pilot) StorageState(ctx context.Context) (*StorageState, error) + func (p *Pilot) Title(ctx context.Context) (string, error) + func (p *Pilot) Touch(ctx context.Context) (*Touch, error) + func (p *Pilot) Tracing() *Tracing + func (p *Pilot) URL(ctx context.Context) (string, error) + func (p *Pilot) Unroute(ctx context.Context, pattern string) error + func (p *Pilot) WaitForFunction(ctx context.Context, fn string, timeout time.Duration) error + func (p *Pilot) WaitForLoad(ctx context.Context, state string, timeout time.Duration) error + func (p *Pilot) WaitForNavigation(ctx context.Context, timeout time.Duration) error + func (p *Pilot) WaitForURL(ctx context.Context, pattern string, timeout time.Duration) error + type PopupHandler func(*Pilot) + type Request struct + Headers map[string]string + IsNavigationRequest bool + Method string + PostData string + ResourceType string + URL string + type RequestHandler func(*Request) + type Response struct + Body []byte + Headers map[string]string + Status int + StatusText string + URL string + type ResponseHandler func(*Response) + type Route struct + Request *Request + func (r *Route) Abort(ctx context.Context) error + func (r *Route) Continue(ctx context.Context, opts *ContinueOptions) error + func (r *Route) Fulfill(ctx context.Context, opts FulfillOptions) error + type RouteHandler func(ctx context.Context, route *Route) error + type RouteInfo struct + ContentType string + Pattern string + Status int + type ScrollOptions struct + Selector string + type SelectOptionValues struct + Indexes []int + Labels []string + Values []string + type SetCookieParam struct + Domain string + Expires float64 + HTTPOnly bool + Name string + PartitionKey string + Path string + SameSite string + Secure bool + URL string + Value string + type SetWindowOptions struct + Height *int + State string + Width *int + X *int + Y *int + type StorageState struct + Cookies []Cookie + Origins []StorageStateOrigin + type StorageStateOrigin struct + LocalStorage map[string]string + Origin string + SessionStorage map[string]string + type TimeoutError struct + Reason string + Selector string + Timeout int64 + func (e *TimeoutError) Error() string + type Touch struct + func NewTouch(client *BiDiClient, browsingContext string) *Touch + func (t *Touch) Pinch(ctx context.Context, x, y float64, scale float64) error + func (t *Touch) Swipe(ctx context.Context, startX, startY, endX, endY float64) error + func (t *Touch) Tap(ctx context.Context, x, y float64) error + type Tracing struct + func (t *Tracing) Start(ctx context.Context, opts *TracingStartOptions) error + func (t *Tracing) StartChunk(ctx context.Context, opts *TracingChunkOptions) error + func (t *Tracing) StartGroup(ctx context.Context, name string, opts *TracingGroupOptions) error + func (t *Tracing) Stop(ctx context.Context, opts *TracingStopOptions) ([]byte, error) + func (t *Tracing) StopChunk(ctx context.Context, opts *TracingChunkOptions) ([]byte, error) + func (t *Tracing) StopGroup(ctx context.Context) error + type TracingChunkOptions struct + Name string + Title string + type TracingGroupOptions struct + Location string + type TracingStartOptions struct + Categories []string + Name string + Screenshots bool + Snapshots bool + Sources bool + Title string + type TracingStopOptions struct + Path string + type Video struct + FilePath string + func (vid *Video) Delete(ctx context.Context) error + func (vid *Video) Path() string + type VideoOptions struct + Dir string + Size *VideoSize + type VideoSize struct + Height int + Width int + type Viewport struct + Height int + Width int + type WebSocketCloseHandler func(code int, reason string) + type WebSocketHandler func(*WebSocketInfo) + type WebSocketInfo struct + IsClosed bool + URL string + func (ws *WebSocketInfo) OnClose(handler WebSocketCloseHandler) + func (ws *WebSocketInfo) OnMessage(handler WebSocketMessageHandler) + type WebSocketMessage struct + Data string + Direction string + IsBinary bool + SocketID string + type WebSocketMessageHandler func(*WebSocketMessage) + type WindowState struct + Height int + IsVisible bool + State string + Width int + X int + Y int