Documentation
¶
Index ¶
- Constants
- type ActRequest
- type Action
- type CleanupRequest
- type CleanupResult
- type ClickAction
- type CloseRequest
- type CloseResult
- type Config
- type ConsoleError
- type Cookie
- type ElementState
- type Error
- type ErrorDetails
- type Executable
- type FillAction
- type FocusedElement
- type GotoAction
- type InteractiveElement
- type Kind
- type NavigationAction
- type NetworkError
- type PageError
- type PageSummary
- type PressAction
- type ScrollAction
- type SelectAction
- type Service
- func (s *Service) Act(ctx context.Context, req ActRequest) (Snapshot, error)
- func (s *Service) CleanupStale(req CleanupRequest) CleanupResult
- func (s *Service) Close() error
- func (s *Service) CloseSession(req CloseRequest) (CloseResult, error)
- func (s *Service) Snapshot(ctx context.Context, req SnapshotRequest) (Snapshot, error)
- func (s *Service) Start(ctx context.Context, req StartRequest) (StartResult, error)
- type Size
- type Snapshot
- type SnapshotRequest
- type StartRequest
- type StartResult
- type Viewport
- type WaitAction
- type WaitResponseAction
- type WaitSelectorAction
- type WaitTextAction
- type WaitURLAction
- type WaitUntil
Constants ¶
View Source
const ( ErrNotFound = "BROWSER_NOT_FOUND" ErrLaunchFailed = "LAUNCH_FAILED" ErrProfileInUse = "PROFILE_IN_USE" ErrSessionNotFound = "SESSION_NOT_FOUND" ErrPageNotFound = "PAGE_NOT_FOUND" ErrActionInvalid = "ACTION_INVALID" ErrActionFailed = "ACTION_FAILED" ErrTimeout = "TIMEOUT" ErrCDPFailed = "CDP_FAILED" ErrCDPAmbiguous = "CDP_AMBIGUOUS" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActRequest ¶
type Action ¶
type Action struct {
Kind string
Goto *GotoAction
Click *ClickAction
Fill *FillAction
Press *PressAction
Wait *WaitAction
WaitSelector *WaitSelectorAction
WaitURL *WaitURLAction
WaitText *WaitTextAction
WaitResponse *WaitResponseAction
Select *SelectAction
Scroll *ScrollAction
}
type CleanupRequest ¶
type CleanupResult ¶
type ClickAction ¶
type ClickAction struct{ Selector string }
type CloseRequest ¶
type CloseRequest struct {
SessionID string
}
type CloseResult ¶
type ConsoleError ¶
type ConsoleError struct {
Message string `json:"message"`
}
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
URL string `json:"url,omitempty"`
Domain string `json:"domain,omitempty"`
Path string `json:"path,omitempty"`
Expires float64 `json:"expires,omitempty"`
HTTPOnly bool `json:"http_only,omitempty"`
Secure bool `json:"secure,omitempty"`
SameSite string `json:"same_site,omitempty"`
}
type ElementState ¶
type ElementState string
const ( StateVisible ElementState = "visible" StateHidden ElementState = "hidden" StateAttached ElementState = "attached" StateDetached ElementState = "detached" )
type Error ¶
type Error struct {
Code string
Message string
Phase string
Details *ErrorDetails
Cause error
}
type ErrorDetails ¶
type ErrorDetails struct {
Path string `json:"path,omitempty"`
Browser Kind `json:"browser,omitempty"`
ProfileID string `json:"profile_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
PageID string `json:"page_id,omitempty"`
AvailablePageIDs []string `json:"available_page_ids,omitempty"`
ActionIndex *int `json:"action_index,omitempty"`
Action string `json:"action,omitempty"`
WaitUntil WaitUntil `json:"wait_until,omitempty"`
Direction int64 `json:"direction,omitempty"`
URL string `json:"url,omitempty"`
URLPattern string `json:"url_pattern,omitempty"`
Method string `json:"method,omitempty"`
Status int `json:"status,omitempty"`
Field string `json:"field,omitempty"`
Reason string `json:"reason,omitempty"`
Selector string `json:"selector,omitempty"`
ItemIndex *int `json:"index,omitempty"`
Count int `json:"count,omitempty"`
}
ErrorDetails is deliberately typed so dynamic maps never cross the browser service boundary. The app protocol layer converts it to MCP/JSON output.
type Executable ¶
func FindExecutable ¶
func FindExecutable(configured string, requested Kind) (Executable, error)
type FillAction ¶
type FocusedElement ¶
type FocusedElement struct {
Tag string `json:"tag"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Text string `json:"text,omitempty"`
Value string `json:"value,omitempty"`
ARIAName string `json:"aria_name,omitempty"`
Selector string `json:"selector,omitempty"`
IsEditable bool `json:"is_editable,omitempty"`
}
type InteractiveElement ¶
type NavigationAction ¶
type NavigationAction struct {
}
type NetworkError ¶
type PageSummary ¶
type PressAction ¶
type ScrollAction ¶
type SelectAction ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CleanupStale ¶
func (s *Service) CleanupStale(req CleanupRequest) CleanupResult
func (*Service) CloseSession ¶
func (s *Service) CloseSession(req CloseRequest) (CloseResult, error)
func (*Service) Start ¶
func (s *Service) Start(ctx context.Context, req StartRequest) (StartResult, error)
type Snapshot ¶
type Snapshot struct {
SessionID string `json:"session_id"`
PageID string `json:"page_id"`
Pages []PageSummary `json:"pages"`
URL string `json:"url"`
Title string `json:"title"`
Text string `json:"text"`
Viewport Viewport `json:"viewport"`
PageSize Size `json:"page_size"`
FocusedElement *FocusedElement `json:"focused_element,omitempty"`
InteractiveElements []InteractiveElement `json:"interactive_elements"`
ConsoleErrors []ConsoleError `json:"console_errors"`
NetworkErrors []NetworkError `json:"network_errors"`
PageErrors []PageError `json:"page_errors"`
PNG []byte `json:"-"`
}
type SnapshotRequest ¶
type StartRequest ¶
type StartResult ¶
type WaitAction ¶
type WaitResponseAction ¶
type WaitSelectorAction ¶
type WaitSelectorAction struct {
Selector string
State ElementState
Timeout time.Duration
}
type WaitTextAction ¶
type WaitTextAction struct {
Text string
Exact bool
State ElementState
Timeout time.Duration
}
type WaitURLAction ¶
Click to show internal directories.
Click to hide internal directories.