Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config holds configuration for the browser server.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Hooks ¶
type Hooks struct {
OnNavigate func(ctx context.Context, sessionID string, url string) error
// OnPageLoad is called when a page finishes loading.
OnPageLoad func(ctx context.Context, sessionID string, title string) error
// WorkspaceLauncher integrates with an external workspace manager
// (e.g., macOS virtual display spaces). Optional.
WorkspaceLauncher WorkspaceLauncher
}
Hooks allows the host application to intercept browser events.
type Option ¶
type Option func(*Server)
Option is a functional option for Server.
func WithDataDir ¶
WithDataDir sets the data directory for browser profiles.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides browser automation as an embeddable HTTP service.
Usage (embedded):
srv, _ := dwbrowser.NewServer(dwbrowser.WithAddr(":8033"))
mux.Handle("/browser/", http.StripPrefix("/browser", srv.Handler()))
Usage (standalone):
srv, _ := dwbrowser.NewServer() srv.ListenAndServe(ctx)
func (*Server) Handler ¶
Handler returns an http.Handler for embedding into an existing mux. Routes are relative (no /api/ prefix); the caller may add a prefix via http.StripPrefix if needed.
func (*Server) ListenAndServe ¶
ListenAndServe starts a standalone HTTP server on s.config.Addr. It blocks until ctx is cancelled.
func (*Server) Pool ¶
func (s *Server) Pool() *browser.BrowserPool
Pool returns the underlying BrowserPool for programmatic access. May return nil if the pool has not been initialized yet.
type WorkspaceLauncher ¶
type WorkspaceLauncher interface {
// LaunchChromeInSpace launches Chrome in a dedicated workspace space.
// Returns the Chrome DevTools WebSocket URL and the process PID.
LaunchChromeInSpace(ctx context.Context, profile string) (wsURL string, pid int, err error)
}
WorkspaceLauncher abstracts launching Chrome inside a managed workspace/space.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browser — chromeHandleImpl: cross-platform ChromeHandle owning *exec.Cmd.
|
Package browser — chromeHandleImpl: cross-platform ChromeHandle owning *exec.Cmd. |
|
_archive
compat.go provides backward-compatible stubs for types used by internal/desktop and internal/skill that were in the old browser package.
|
compat.go provides backward-compatible stubs for types used by internal/desktop and internal/skill that were in the old browser package. |
|
audit
Package audit 提供引擎无关的浏览器审计框架。
|
Package audit 提供引擎无关的浏览器审计框架。 |
|
safari
Package safari wraps the ax-bridge.swift native binary which reads iOS Simulator accessibility trees via the macOS AXUIElement API.
|
Package safari wraps the ax-bridge.swift native binary which reads iOS Simulator accessibility trees via the macOS AXUIElement API. |