Documentation
¶
Index ¶
- Variables
- func FormatRemoteObject(obj *RemoteObject) string
- type AccessibilityNode
- type BoundingBox
- type Bridge
- type BridgeEvent
- type CSSCoverageEntry
- type CSSCoverageResult
- type CaretPositionResult
- type Client
- func (c *Client) AllPages(ctx context.Context) ([]TargetInfo, error)
- func (c *Client) AttachToTarget(ctx context.Context, targetID string) (string, error)
- func (c *Client) BlockURLs(ctx context.Context, targetID string, patterns []string) error
- func (c *Client) Call(ctx context.Context, method string, params interface{}) (json.RawMessage, error)
- func (c *Client) CallSession(ctx context.Context, sessionID string, method string, params interface{}) (json.RawMessage, error)
- func (c *Client) CaptureConsole(ctx context.Context, targetID string) (<-chan ConsoleMessage, func(), error)
- func (c *Client) CaptureExceptions(ctx context.Context, targetID string) (<-chan ExceptionInfo, func(), error)
- func (c *Client) CaptureHAR(ctx context.Context, targetID string, duration time.Duration) (*HARLog, error)
- func (c *Client) CaptureNetwork(ctx context.Context, targetID string) (<-chan NetworkEvent, func(), error)
- func (c *Client) CaptureTrace(ctx context.Context, targetID string, duration time.Duration) ([]byte, error)
- func (c *Client) Check(ctx context.Context, targetID string, selector string) error
- func (c *Client) Clear(ctx context.Context, targetID string, selector string) error
- func (c *Client) ClearCookies(ctx context.Context, targetID string) error
- func (c *Client) ClearLocalStorage(ctx context.Context, targetID string) error
- func (c *Client) ClearSessionStorage(ctx context.Context, targetID string) error
- func (c *Client) Click(ctx context.Context, targetID string, selector string) error
- func (c *Client) ClickAt(ctx context.Context, targetID string, x, y float64) error
- func (c *Client) Close() error
- func (c *Client) CloseTab(ctx context.Context, targetID string) error
- func (c *Client) CountElements(ctx context.Context, targetID string, selector string) (int, error)
- func (c *Client) DeleteCookie(ctx context.Context, targetID string, name, domain string) error
- func (c *Client) DisableIntercept(ctx context.Context, targetID string) error
- func (c *Client) DisableNetworkThrottling(ctx context.Context, targetID string) error
- func (c *Client) DispatchEvent(ctx context.Context, targetID string, selector string, eventType string) (*DispatchEventResult, error)
- func (c *Client) DoubleClick(ctx context.Context, targetID string, selector string) error
- func (c *Client) Drag(ctx context.Context, targetID string, sourceSelector, destSelector string) error
- func (c *Client) Emulate(ctx context.Context, targetID string, device DeviceInfo) error
- func (c *Client) EmulateNetworkConditions(ctx context.Context, targetID string, conditions NetworkConditions) error
- func (c *Client) EnableIntercept(ctx context.Context, targetID string, config InterceptConfig) error
- func (c *Client) Eval(ctx context.Context, targetID string, expression string) (*EvalResult, error)
- func (c *Client) EvalInFrame(ctx context.Context, targetID string, frameID string, expression string) (*EvalResult, error)
- func (c *Client) EvalRich(ctx context.Context, targetID string, expression string) (*RemoteObject, error)
- func (c *Client) ExecuteScriptFile(ctx context.Context, targetID string, content string) (*EvalResult, error)
- func (c *Client) Exists(ctx context.Context, targetID string, selector string) (bool, error)
- func (c *Client) Fill(ctx context.Context, targetID string, selector string, text string) error
- func (c *Client) FindText(ctx context.Context, targetID string, text string) (*FindResult, error)
- func (c *Client) Focus(ctx context.Context, targetID string, selector string) error
- func (c *Client) GetAccessibilityTree(ctx context.Context, targetID string) ([]AccessibilityNode, error)
- func (c *Client) GetAttribute(ctx context.Context, targetID string, selector string, name string) (string, error)
- func (c *Client) GetBoundingBox(ctx context.Context, targetID string, selector string) (*BoundingBox, error)
- func (c *Client) GetCSSCoverage(ctx context.Context, targetID string) (*CSSCoverageResult, error)
- func (c *Client) GetCaretPosition(ctx context.Context, targetID string, selector string) (*CaretPositionResult, error)
- func (c *Client) GetComputedStyle(ctx context.Context, targetID string, selector string, property string) (*ComputedStyleResult, error)
- func (c *Client) GetComputedStyles(ctx context.Context, targetID string, selector string, properties []string) (map[string]string, error)
- func (c *Client) GetCookies(ctx context.Context, targetID string) ([]Cookie, error)
- func (c *Client) GetCoverage(ctx context.Context, targetID string) (*CoverageResult, error)
- func (c *Client) GetDOMSnapshot(ctx context.Context, targetID string) (*DOMSnapshotResult, error)
- func (c *Client) GetElementLayout(ctx context.Context, targetID string, selector string, depth int) (*ElementLayout, error)
- func (c *Client) GetEventListeners(ctx context.Context, targetID string, selector string) (*EventListenersResult, error)
- func (c *Client) GetForms(ctx context.Context, targetID string) ([]FormInfo, error)
- func (c *Client) GetFrames(ctx context.Context, targetID string) ([]FrameInfo, error)
- func (c *Client) GetHTML(ctx context.Context, targetID string, selector string) (string, error)
- func (c *Client) GetImages(ctx context.Context, targetID string) ([]ImageInfo, error)
- func (c *Client) GetLocalStorage(ctx context.Context, targetID string, key string) (string, error)
- func (c *Client) GetPageInfo(ctx context.Context, targetID string) (*PageInfo, error)
- func (c *Client) GetPageSource(ctx context.Context, targetID string) (string, error)
- func (c *Client) GetPerformanceMetrics(ctx context.Context, targetID string) (map[string]float64, error)
- func (c *Client) GetProperties(ctx context.Context, sessionID, objectID string, ownOnly bool) ([]PropertyDescriptor, error)
- func (c *Client) GetResponseBody(ctx context.Context, targetID string, requestID string) (*ResponseBodyResult, error)
- func (c *Client) GetScripts(ctx context.Context, targetID string) (*ScriptsResult, error)
- func (c *Client) GetSelection(ctx context.Context, targetID string) (*SelectionResult, error)
- func (c *Client) GetSessionStorage(ctx context.Context, targetID string, key string) (string, error)
- func (c *Client) GetStylesheets(ctx context.Context, targetID string) (*StylesheetsResult, error)
- func (c *Client) GetText(ctx context.Context, targetID string, selector string) (string, error)
- func (c *Client) GetTitle(ctx context.Context, targetID string) (string, error)
- func (c *Client) GetURL(ctx context.Context, targetID string) (string, error)
- func (c *Client) GetValue(ctx context.Context, targetID string, selector string) (string, error)
- func (c *Client) GoBack(ctx context.Context, targetID string) error
- func (c *Client) GoForward(ctx context.Context, targetID string) error
- func (c *Client) HandleDialog(ctx context.Context, targetID string, action string, promptText string) error
- func (c *Client) HideHighlight(ctx context.Context, targetID string) error
- func (c *Client) Highlight(ctx context.Context, targetID string, selector string) error
- func (c *Client) Hover(ctx context.Context, targetID string, selector string) error
- func (c *Client) IsVisible(ctx context.Context, targetID string, selector string) (bool, error)
- func (c *Client) MouseMove(ctx context.Context, targetID string, x, y float64) (*MouseMoveResult, error)
- func (c *Client) Navigate(ctx context.Context, targetID string, url string) (*NavigateResult, error)
- func (c *Client) NavigateAndWait(ctx context.Context, targetID string, url string) (*NavigateResult, error)
- func (c *Client) NewTab(ctx context.Context, url string) (string, error)
- func (c *Client) NewTabAndWait(ctx context.Context, url string) (string, error)
- func (c *Client) Pages(ctx context.Context) ([]TargetInfo, error)
- func (c *Client) Pinch(ctx context.Context, targetID string, selector string, direction string) (*PinchResult, error)
- func (c *Client) PressKey(ctx context.Context, targetID string, key string) error
- func (c *Client) PressKeyWithModifiers(ctx context.Context, targetID string, key string, mods KeyModifiers) error
- func (c *Client) PrintToPDF(ctx context.Context, targetID string, opts PDFOptions) ([]byte, error)
- func (c *Client) Query(ctx context.Context, targetID string, selector string) (*QueryResult, error)
- func (c *Client) QueryShadow(ctx context.Context, targetID string, hostSelector string, ...) (*QueryResult, error)
- func (c *Client) RawCall(ctx context.Context, method string, params json.RawMessage) (json.RawMessage, error)
- func (c *Client) RawCallSession(ctx context.Context, targetID string, method string, params json.RawMessage) (json.RawMessage, error)
- func (c *Client) ReadClipboard(ctx context.Context, targetID string) (string, error)
- func (c *Client) RecordNavigations(ctx context.Context, targetID string) (<-chan RecordedEvent, error)
- func (c *Client) ReleaseObject(ctx context.Context, sessionID, objectID string) error
- func (c *Client) ReleaseObjectGroup(ctx context.Context, sessionID, group string) error
- func (c *Client) Reload(ctx context.Context, targetID string, ignoreCache bool) error
- func (c *Client) RightClick(ctx context.Context, targetID string, selector string) error
- func (c *Client) Screenshot(ctx context.Context, targetID string, opts ScreenshotOptions) ([]byte, error)
- func (c *Client) ScreenshotElement(ctx context.Context, targetID string, selector string, opts ScreenshotOptions) ([]byte, *BoundingBox, error)
- func (c *Client) ScreenshotFull(ctx context.Context, targetID string, opts ScreenshotOptions) ([]byte, error)
- func (c *Client) ScrollBy(ctx context.Context, targetID string, x, y int) error
- func (c *Client) ScrollIntoView(ctx context.Context, targetID string, selector string) error
- func (c *Client) ScrollToBottom(ctx context.Context, targetID string) error
- func (c *Client) ScrollToTop(ctx context.Context, targetID string) error
- func (c *Client) SelectOption(ctx context.Context, targetID string, selector string, value string) error
- func (c *Client) SetCookie(ctx context.Context, targetID string, cookie Cookie) error
- func (c *Client) SetEmulatedMedia(ctx context.Context, targetID string, features MediaFeatures) error
- func (c *Client) SetGeolocation(ctx context.Context, targetID string, latitude, longitude, accuracy float64) error
- func (c *Client) SetLocalStorage(ctx context.Context, targetID string, key, value string) error
- func (c *Client) SetOfflineMode(ctx context.Context, targetID string, offline bool) error
- func (c *Client) SetPermission(ctx context.Context, targetID string, permission, state string) error
- func (c *Client) SetSessionStorage(ctx context.Context, targetID string, key, value string) error
- func (c *Client) SetUserAgent(ctx context.Context, targetID string, userAgent string) error
- func (c *Client) SetValue(ctx context.Context, targetID string, selector string, value string) (*SetValueResult, error)
- func (c *Client) SetViewport(ctx context.Context, targetID string, width, height int) error
- func (c *Client) StartBridge(ctx context.Context, targetID string, script string) (*Bridge, error)
- func (c *Client) Swipe(ctx context.Context, targetID string, selector string, direction string) (*SwipeResult, error)
- func (c *Client) TakeHeapSnapshot(ctx context.Context, targetID string) ([]byte, error)
- func (c *Client) Tap(ctx context.Context, targetID string, selector string) error
- func (c *Client) Targets(ctx context.Context) ([]TargetInfo, error)
- func (c *Client) TripleClick(ctx context.Context, targetID string, selector string) error
- func (c *Client) Type(ctx context.Context, targetID string, text string) error
- func (c *Client) UnblockURLs(ctx context.Context, targetID string) error
- func (c *Client) Uncheck(ctx context.Context, targetID string, selector string) error
- func (c *Client) UploadFile(ctx context.Context, targetID string, selector string, files []string) error
- func (c *Client) Version(ctx context.Context) (*VersionInfo, error)
- func (c *Client) WaitFor(ctx context.Context, targetID string, selector string, timeout time.Duration) error
- func (c *Client) WaitForFunction(ctx context.Context, targetID string, expression string, timeout time.Duration) error
- func (c *Client) WaitForGone(ctx context.Context, targetID string, selector string, timeout time.Duration) error
- func (c *Client) WaitForLoad(ctx context.Context, targetID string) error
- func (c *Client) WaitForNavigation(ctx context.Context, targetID string, timeout time.Duration) error
- func (c *Client) WaitForNetworkIdle(ctx context.Context, targetID string, idleTime time.Duration) error
- func (c *Client) WaitForRequest(ctx context.Context, targetID string, pattern string, timeout time.Duration) (*WaitRequestResult, error)
- func (c *Client) WaitForResponse(ctx context.Context, targetID string, pattern string, timeout time.Duration) (*WaitResponseResult, error)
- func (c *Client) WaitForText(ctx context.Context, targetID string, text string, timeout time.Duration) error
- func (c *Client) WaitForURL(ctx context.Context, targetID string, pattern string, timeout time.Duration) (string, error)
- func (c *Client) WebSocketURL() string
- func (c *Client) WriteClipboard(ctx context.Context, targetID string, text string) error
- type ComputedStyleResult
- type ConsoleMessage
- type Cookie
- type CoverageRange
- type CoverageResult
- type DOMSnapshotResult
- type DeviceInfo
- type DispatchEventResult
- type ElementLayout
- type EntryPreview
- type EvalResult
- type EventListenerInfo
- type EventListenersResult
- type ExceptionInfo
- type FindResult
- type FormInfo
- type FrameInfo
- type HARContent
- type HARCreator
- type HAREntry
- type HARHeader
- type HARLog
- type HARQuery
- type HARRequest
- type HARResponse
- type HARTimings
- type HeapSnapshotResult
- type ImageInfo
- type InputInfo
- type InterceptConfig
- type KeyModifiers
- type MediaFeatures
- type MouseMoveResult
- type NavigateResult
- type NetworkConditions
- type NetworkEvent
- type ObjectPreview
- type PDFOptions
- type PageInfo
- type PinchResult
- type PropertyDescriptor
- type PropertyPreview
- type ProtocolError
- type QueryResult
- type RecordedEvent
- type RemoteObject
- type ResponseBodyResult
- type ScreenshotOptions
- type ScreenshotResult
- type ScriptCoverage
- type ScriptInfo
- type ScriptsResult
- type SelectionResult
- type SetValueResult
- type StylesheetInfo
- type StylesheetsResult
- type SwipeResult
- type TargetInfo
- type TraceResult
- type VersionInfo
- type WaitRequestResult
- type WaitResponseResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnectionClosed = errors.New("connection closed") ErrProtocolError = errors.New("protocol error") )
Errors
var CommonDevices = map[string]DeviceInfo{ "iPhone 12": { Name: "iPhone 12", Width: 390, Height: 844, DeviceScaleFactor: 3, Mobile: true, UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, "iPhone 12 Pro": { Name: "iPhone 12 Pro", Width: 390, Height: 844, DeviceScaleFactor: 3, Mobile: true, UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, "iPhone 12 Pro Max": { Name: "iPhone 12 Pro Max", Width: 428, Height: 926, DeviceScaleFactor: 3, Mobile: true, UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, "iPhone SE": { Name: "iPhone SE", Width: 375, Height: 667, DeviceScaleFactor: 2, Mobile: true, UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, "Pixel 5": { Name: "Pixel 5", Width: 393, Height: 851, DeviceScaleFactor: 2.75, Mobile: true, UserAgent: "Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36", }, "Galaxy S21": { Name: "Galaxy S21", Width: 360, Height: 800, DeviceScaleFactor: 3, Mobile: true, UserAgent: "Mozilla/5.0 (Linux; Android 11; SM-G991B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36", }, "iPad": { Name: "iPad", Width: 768, Height: 1024, DeviceScaleFactor: 2, Mobile: true, UserAgent: "Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, "iPad Pro": { Name: "iPad Pro", Width: 1024, Height: 1366, DeviceScaleFactor: 2, Mobile: true, UserAgent: "Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, }
CommonDevices is a map of common device names to their configurations.
var NetworkPresets = map[string]NetworkConditions{ "slow3g": { Offline: false, Latency: 2000, DownloadThroughput: 50000, UploadThroughput: 25000, }, "fast3g": { Offline: false, Latency: 563, DownloadThroughput: 180000, UploadThroughput: 84375, }, "4g": { Offline: false, Latency: 170, DownloadThroughput: 1500000, UploadThroughput: 750000, }, "wifi": { Offline: false, Latency: 28, DownloadThroughput: 3750000, UploadThroughput: 1875000, }, }
NetworkPresets contains common network condition presets.
Functions ¶
func FormatRemoteObject ¶ added in v1.9.0
func FormatRemoteObject(obj *RemoteObject) string
FormatRemoteObject is the exported version for use outside the package.
Types ¶
type AccessibilityNode ¶
type AccessibilityNode struct {
NodeID string `json:"nodeId"`
Role string `json:"role"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Value string `json:"value,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
Children []AccessibilityNode `json:"children,omitempty"`
}
AccessibilityNode represents a node in the accessibility tree.
type BoundingBox ¶
type BoundingBox struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
}
BoundingBox represents an element's position and size.
type Bridge ¶ added in v1.8.0
type Bridge struct {
Events <-chan BridgeEvent
// contains filtered or unexported fields
}
Bridge is a persistent bidirectional message channel between the CLI and client-side JavaScript running in a browser tab.
func (*Bridge) Close ¶ added in v1.8.0
func (b *Bridge) Close()
Close shuts down the bridge and cleans up resources.
func (*Bridge) CloseIterator ¶ added in v1.8.0
CloseIterator signals the JS async iterator to close, allowing the script to finish cleanly. The bridge remains open to receive the final closed event.
type BridgeEvent ¶ added in v1.8.0
type BridgeEvent struct {
Type string `json:"type"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
BridgeEvent represents an event from a bridge session.
type CSSCoverageEntry ¶
type CSSCoverageEntry struct {
StyleSheetID string `json:"styleSheetId"`
StartOffset int `json:"startOffset"`
EndOffset int `json:"endOffset"`
Used bool `json:"used"`
}
CSSCoverageEntry represents a CSS rule usage entry.
type CSSCoverageResult ¶
type CSSCoverageResult struct {
Entries []CSSCoverageEntry `json:"entries"`
}
CSSCoverageResult contains CSS coverage data.
type CaretPositionResult ¶
CaretPositionResult contains the caret position in an input element.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Chrome DevTools Protocol client.
func (*Client) AllPages ¶ added in v1.9.0
func (c *Client) AllPages(ctx context.Context) ([]TargetInfo, error)
AllPages returns all page targets including internal pages (DevTools, extensions).
func (*Client) AttachToTarget ¶ added in v1.9.0
AttachToTarget returns (or caches) a CDP session for the given target.
func (*Client) BlockURLs ¶
BlockURLs blocks network requests matching the specified URL patterns. Uses the Network.setBlockedURLs protocol method.
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, method string, params interface{}) (json.RawMessage, error)
Call sends a protocol command and waits for the response.
func (*Client) CallSession ¶
func (c *Client) CallSession(ctx context.Context, sessionID string, method string, params interface{}) (json.RawMessage, error)
CallSession sends a protocol command to a specific session and waits for the response.
func (*Client) CaptureConsole ¶
func (c *Client) CaptureConsole(ctx context.Context, targetID string) (<-chan ConsoleMessage, func(), error)
CaptureConsole starts capturing console messages from a page. Returns a channel that receives ConsoleMessage and a stop function. The stop function MUST be called when done to release resources. The channel is closed when stop is called or when the client is closed.
func (*Client) CaptureExceptions ¶
func (c *Client) CaptureExceptions(ctx context.Context, targetID string) (<-chan ExceptionInfo, func(), error)
CaptureExceptions starts capturing JavaScript exceptions from a page. Returns a channel that receives ExceptionInfo and a stop function. The stop function MUST be called when done to release resources. The channel is closed when stop is called or when the client is closed.
func (*Client) CaptureHAR ¶
func (c *Client) CaptureHAR(ctx context.Context, targetID string, duration time.Duration) (*HARLog, error)
CaptureHAR captures network activity and returns it as a HAR log.
func (*Client) CaptureNetwork ¶
func (c *Client) CaptureNetwork(ctx context.Context, targetID string) (<-chan NetworkEvent, func(), error)
CaptureNetwork starts capturing network events from a page. Returns a channel that receives NetworkEvent and a stop function. The stop function MUST be called when done to release resources. The channel is closed when stop is called or when the client is closed.
func (*Client) CaptureTrace ¶
func (c *Client) CaptureTrace(ctx context.Context, targetID string, duration time.Duration) ([]byte, error)
CaptureTrace captures a Chrome performance trace for the given duration.
func (*Client) ClearCookies ¶
ClearCookies clears all cookies.
func (*Client) ClearLocalStorage ¶
ClearLocalStorage clears all localStorage.
func (*Client) ClearSessionStorage ¶
ClearSessionStorage clears all sessionStorage.
func (*Client) CountElements ¶
CountElements returns the number of elements matching the selector.
func (*Client) DeleteCookie ¶
DeleteCookie deletes a cookie by name and domain.
func (*Client) DisableIntercept ¶
DisableIntercept disables request/response interception for the specified target.
func (*Client) DisableNetworkThrottling ¶
DisableNetworkThrottling disables network throttling.
func (*Client) DispatchEvent ¶
func (c *Client) DispatchEvent(ctx context.Context, targetID string, selector string, eventType string) (*DispatchEventResult, error)
DispatchEvent dispatches a custom event on an element.
func (*Client) DoubleClick ¶
DoubleClick double-clicks on an element specified by selector.
func (*Client) Drag ¶
func (c *Client) Drag(ctx context.Context, targetID string, sourceSelector, destSelector string) error
Drag performs a drag from one element to another.
func (*Client) EmulateNetworkConditions ¶
func (c *Client) EmulateNetworkConditions(ctx context.Context, targetID string, conditions NetworkConditions) error
EmulateNetworkConditions sets network throttling conditions.
func (*Client) EnableIntercept ¶
func (c *Client) EnableIntercept(ctx context.Context, targetID string, config InterceptConfig) error
EnableIntercept enables request/response interception for the specified target.
func (*Client) EvalInFrame ¶
func (c *Client) EvalInFrame(ctx context.Context, targetID string, frameID string, expression string) (*EvalResult, error)
EvalInFrame evaluates JavaScript in a specific frame.
func (*Client) EvalRich ¶ added in v1.9.0
func (c *Client) EvalRich(ctx context.Context, targetID string, expression string) (*RemoteObject, error)
EvalRich evaluates a JavaScript expression and returns the full RemoteObject with preview data, suitable for interactive object exploration.
func (*Client) ExecuteScriptFile ¶
func (c *Client) ExecuteScriptFile(ctx context.Context, targetID string, content string) (*EvalResult, error)
ExecuteScriptFile reads and executes JavaScript from a file.
func (*Client) GetAccessibilityTree ¶
func (c *Client) GetAccessibilityTree(ctx context.Context, targetID string) ([]AccessibilityNode, error)
GetAccessibilityTree returns the accessibility tree for the page.
func (*Client) GetAttribute ¶
func (c *Client) GetAttribute(ctx context.Context, targetID string, selector string, name string) (string, error)
GetAttribute returns the value of an attribute for an element.
func (*Client) GetBoundingBox ¶
func (c *Client) GetBoundingBox(ctx context.Context, targetID string, selector string) (*BoundingBox, error)
GetBoundingBox returns the bounding box of an element.
func (*Client) GetCSSCoverage ¶
GetCSSCoverage captures CSS rule usage data.
func (*Client) GetCaretPosition ¶
func (c *Client) GetCaretPosition(ctx context.Context, targetID string, selector string) (*CaretPositionResult, error)
GetCaretPosition returns the caret (cursor) position in an input or textarea element.
func (*Client) GetComputedStyle ¶
func (c *Client) GetComputedStyle(ctx context.Context, targetID string, selector string, property string) (*ComputedStyleResult, error)
GetComputedStyle returns the computed style value for a CSS property of an element.
func (*Client) GetComputedStyles ¶
func (c *Client) GetComputedStyles(ctx context.Context, targetID string, selector string, properties []string) (map[string]string, error)
GetComputedStyles returns computed CSS styles for an element.
func (*Client) GetCookies ¶
GetCookies returns all cookies for the page.
func (*Client) GetCoverage ¶
GetCoverage returns JavaScript code coverage data.
func (*Client) GetDOMSnapshot ¶
GetDOMSnapshot captures a full serialized DOM tree.
func (*Client) GetElementLayout ¶
func (c *Client) GetElementLayout(ctx context.Context, targetID string, selector string, depth int) (*ElementLayout, error)
GetElementLayout returns comprehensive layout info for an element and its children.
func (*Client) GetEventListeners ¶
func (c *Client) GetEventListeners(ctx context.Context, targetID string, selector string) (*EventListenersResult, error)
GetEventListeners returns the event listeners attached to a DOM element.
func (*Client) GetLocalStorage ¶
GetLocalStorage gets a value from localStorage.
func (*Client) GetPageInfo ¶
GetPageInfo returns combined information about the current page.
func (*Client) GetPageSource ¶
GetPageSource returns the full HTML source of the page.
func (*Client) GetPerformanceMetrics ¶
func (c *Client) GetPerformanceMetrics(ctx context.Context, targetID string) (map[string]float64, error)
GetPerformanceMetrics returns performance metrics from the page.
func (*Client) GetProperties ¶ added in v1.9.0
func (c *Client) GetProperties(ctx context.Context, sessionID, objectID string, ownOnly bool) ([]PropertyDescriptor, error)
GetProperties fetches the properties of a remote object.
func (*Client) GetResponseBody ¶
func (c *Client) GetResponseBody(ctx context.Context, targetID string, requestID string) (*ResponseBodyResult, error)
GetResponseBody retrieves the response body for a network request by its request ID.
func (*Client) GetScripts ¶
GetScripts returns all script elements on the page.
func (*Client) GetSelection ¶
GetSelection returns the currently selected text on the page.
func (*Client) GetSessionStorage ¶
func (c *Client) GetSessionStorage(ctx context.Context, targetID string, key string) (string, error)
GetSessionStorage gets a value from sessionStorage.
func (*Client) GetStylesheets ¶
GetStylesheets returns all stylesheets on the page.
func (*Client) HandleDialog ¶
func (c *Client) HandleDialog(ctx context.Context, targetID string, action string, promptText string) error
HandleDialog sets up automatic dialog handling. action can be "accept" or "dismiss". promptText is the text to enter for prompts (optional).
func (*Client) HideHighlight ¶
HideHighlight removes any element highlight.
func (*Client) MouseMove ¶
func (c *Client) MouseMove(ctx context.Context, targetID string, x, y float64) (*MouseMoveResult, error)
MouseMove moves the mouse to the specified coordinates without clicking.
func (*Client) Navigate ¶
func (c *Client) Navigate(ctx context.Context, targetID string, url string) (*NavigateResult, error)
Navigate navigates a target to the given URL and waits for load.
func (*Client) NavigateAndWait ¶
func (c *Client) NavigateAndWait(ctx context.Context, targetID string, url string) (*NavigateResult, error)
NavigateAndWait navigates to a URL and waits for the page load event.
func (*Client) NewTabAndWait ¶ added in v1.6.0
NewTabAndWait creates a new tab, navigates to the URL, and waits for the page to load.
func (*Client) Pages ¶
func (c *Client) Pages(ctx context.Context) ([]TargetInfo, error)
Pages returns only page targets (tabs).
func (*Client) Pinch ¶
func (c *Client) Pinch(ctx context.Context, targetID string, selector string, direction string) (*PinchResult, error)
Pinch performs a two-finger pinch gesture on an element.
func (*Client) PressKeyWithModifiers ¶
func (c *Client) PressKeyWithModifiers(ctx context.Context, targetID string, key string, mods KeyModifiers) error
PressKeyWithModifiers presses a key with modifier keys (Ctrl, Alt, Shift, Meta).
func (*Client) PrintToPDF ¶
PrintToPDF generates a PDF of the page.
func (*Client) QueryShadow ¶
func (c *Client) QueryShadow(ctx context.Context, targetID string, hostSelector string, innerSelector string) (*QueryResult, error)
QueryShadow finds an element inside a shadow DOM. hostSelector is the CSS selector for the shadow host element. innerSelector is the CSS selector to query within the shadow root.
func (*Client) RawCall ¶
func (c *Client) RawCall(ctx context.Context, method string, params json.RawMessage) (json.RawMessage, error)
RawCall sends a raw protocol command with JSON params.
func (*Client) RawCallSession ¶
func (c *Client) RawCallSession(ctx context.Context, targetID string, method string, params json.RawMessage) (json.RawMessage, error)
RawCallSession sends a raw protocol command to a specific target/session.
func (*Client) ReadClipboard ¶
ReadClipboard reads text from the clipboard.
func (*Client) RecordNavigations ¶
func (c *Client) RecordNavigations(ctx context.Context, targetID string) (<-chan RecordedEvent, error)
RecordNavigations subscribes to Page.frameNavigated events and sends top-level navigation URLs to the returned channel. The channel is closed when the context is cancelled or the connection drops.
func (*Client) ReleaseObject ¶ added in v1.9.0
ReleaseObject releases a single remote object.
func (*Client) ReleaseObjectGroup ¶ added in v1.9.0
ReleaseObjectGroup releases all remote objects in a group.
func (*Client) Reload ¶
Reload reloads the page. If ignoreCache is true, the browser cache is bypassed.
func (*Client) RightClick ¶
RightClick right-clicks on an element specified by selector.
func (*Client) Screenshot ¶
func (c *Client) Screenshot(ctx context.Context, targetID string, opts ScreenshotOptions) ([]byte, error)
Screenshot captures a screenshot of a target.
func (*Client) ScreenshotElement ¶
func (c *Client) ScreenshotElement(ctx context.Context, targetID string, selector string, opts ScreenshotOptions) ([]byte, *BoundingBox, error)
ScreenshotElement captures a screenshot of a specific element.
func (*Client) ScreenshotFull ¶ added in v1.5.0
func (c *Client) ScreenshotFull(ctx context.Context, targetID string, opts ScreenshotOptions) ([]byte, error)
ScreenshotFull captures a screenshot of the entire page including content below the viewport.
func (*Client) ScrollIntoView ¶
ScrollIntoView scrolls an element into view.
func (*Client) ScrollToBottom ¶
ScrollToBottom scrolls to the bottom of the page.
func (*Client) ScrollToTop ¶
ScrollToTop scrolls to the top of the page.
func (*Client) SelectOption ¶
func (c *Client) SelectOption(ctx context.Context, targetID string, selector string, value string) error
SelectOption selects an option in a <select> element by value.
func (*Client) SetEmulatedMedia ¶
func (c *Client) SetEmulatedMedia(ctx context.Context, targetID string, features MediaFeatures) error
SetEmulatedMedia sets emulated media features.
func (*Client) SetGeolocation ¶
func (c *Client) SetGeolocation(ctx context.Context, targetID string, latitude, longitude, accuracy float64) error
SetGeolocation overrides the geolocation for the specified target.
func (*Client) SetLocalStorage ¶
SetLocalStorage sets a value in localStorage.
func (*Client) SetOfflineMode ¶
SetOfflineMode enables or disables offline mode for network emulation.
func (*Client) SetPermission ¶
func (c *Client) SetPermission(ctx context.Context, targetID string, permission, state string) error
SetPermission sets the state of a permission for the page origin. permission: geolocation, notifications, midi, midi-sysex, push, camera, microphone, etc. state: granted, denied, prompt
func (*Client) SetSessionStorage ¶
SetSessionStorage sets a value in sessionStorage.
func (*Client) SetUserAgent ¶
SetUserAgent sets a custom user agent for the specified target.
func (*Client) SetValue ¶
func (c *Client) SetValue(ctx context.Context, targetID string, selector string, value string) (*SetValueResult, error)
SetValue directly sets the value of an input/textarea element.
func (*Client) SetViewport ¶
SetViewport sets the browser viewport size.
func (*Client) StartBridge ¶ added in v1.8.0
StartBridge establishes a bidirectional message channel with client-side JS. The provided script receives `send` (function) and `messages` (async iterator) in scope. Events from the bridge (ready, message, error, closed) are delivered on the returned Bridge.Events channel.
func (*Client) Swipe ¶
func (c *Client) Swipe(ctx context.Context, targetID string, selector string, direction string) (*SwipeResult, error)
Swipe performs a touch swipe gesture on an element.
func (*Client) TakeHeapSnapshot ¶
TakeHeapSnapshot captures a V8 heap snapshot and writes it to a file.
func (*Client) Targets ¶
func (c *Client) Targets(ctx context.Context) ([]TargetInfo, error)
Targets returns all browser targets (pages, workers, etc.).
func (*Client) TripleClick ¶
TripleClick triple-clicks on an element specified by selector. This is typically used to select an entire paragraph.
func (*Client) Type ¶
Type sends individual key events for each character in the text. This is useful for inputs that need realistic typing (autocomplete, etc.).
func (*Client) UnblockURLs ¶
UnblockURLs clears all URL blocking patterns.
func (*Client) UploadFile ¶
func (c *Client) UploadFile(ctx context.Context, targetID string, selector string, files []string) error
UploadFile sets files for a file input element.
func (*Client) Version ¶
func (c *Client) Version(ctx context.Context) (*VersionInfo, error)
Version returns the browser version information.
func (*Client) WaitFor ¶
func (c *Client) WaitFor(ctx context.Context, targetID string, selector string, timeout time.Duration) error
WaitFor waits for an element matching the selector to appear.
func (*Client) WaitForFunction ¶
func (c *Client) WaitForFunction(ctx context.Context, targetID string, expression string, timeout time.Duration) error
WaitForFunction waits until a JavaScript expression evaluates to a truthy value.
func (*Client) WaitForGone ¶
func (c *Client) WaitForGone(ctx context.Context, targetID string, selector string, timeout time.Duration) error
WaitForGone waits for an element to be removed from the DOM.
func (*Client) WaitForLoad ¶
WaitForLoad waits for the page load event.
func (*Client) WaitForNavigation ¶
func (c *Client) WaitForNavigation(ctx context.Context, targetID string, timeout time.Duration) error
WaitForNavigation waits for a navigation to complete.
func (*Client) WaitForNetworkIdle ¶
func (c *Client) WaitForNetworkIdle(ctx context.Context, targetID string, idleTime time.Duration) error
WaitForNetworkIdle waits until there are no pending network requests for the specified duration.
func (*Client) WaitForRequest ¶
func (c *Client) WaitForRequest(ctx context.Context, targetID string, pattern string, timeout time.Duration) (*WaitRequestResult, error)
WaitForRequest waits for a network request with a URL containing the pattern.
func (*Client) WaitForResponse ¶
func (c *Client) WaitForResponse(ctx context.Context, targetID string, pattern string, timeout time.Duration) (*WaitResponseResult, error)
WaitForResponse waits for a network response with a URL containing the pattern.
func (*Client) WaitForText ¶
func (c *Client) WaitForText(ctx context.Context, targetID string, text string, timeout time.Duration) error
WaitForText waits for text to appear on the page.
func (*Client) WaitForURL ¶
func (c *Client) WaitForURL(ctx context.Context, targetID string, pattern string, timeout time.Duration) (string, error)
WaitForURL waits for the page URL to contain the given pattern.
func (*Client) WebSocketURL ¶
WebSocketURL returns the WebSocket URL used for this connection.
type ComputedStyleResult ¶
ComputedStyleResult contains the computed style value for an element.
type ConsoleMessage ¶
type ConsoleMessage struct {
Type string `json:"type"` // "log", "warn", "error", "info", "debug"
Text string `json:"text"`
Args []RemoteObject `json:"args,omitempty"` // rich argument data when available
}
ConsoleMessage represents a console message from the browser.
type Cookie ¶
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Domain string `json:"domain,omitempty"`
Path string `json:"path,omitempty"`
Expires float64 `json:"expires,omitempty"`
HTTPOnly bool `json:"httpOnly,omitempty"`
Secure bool `json:"secure,omitempty"`
SameSite string `json:"sameSite,omitempty"`
}
Cookie represents a browser cookie.
type CoverageRange ¶
type CoverageRange struct {
StartOffset int `json:"startOffset"`
EndOffset int `json:"endOffset"`
Count int `json:"count"`
}
CoverageRange represents a covered range in the script.
type CoverageResult ¶
type CoverageResult struct {
Scripts []ScriptCoverage `json:"scripts"`
}
CoverageResult represents JavaScript code coverage data.
type DOMSnapshotResult ¶
type DOMSnapshotResult struct {
Documents []json.RawMessage `json:"documents"`
Strings []string `json:"strings"`
}
DOMSnapshotResult contains a DOM snapshot.
type DeviceInfo ¶
type DeviceInfo struct {
Name string `json:"name"`
Width int `json:"width"`
Height int `json:"height"`
DeviceScaleFactor float64 `json:"deviceScaleFactor"`
Mobile bool `json:"mobile"`
UserAgent string `json:"userAgent"`
}
DeviceInfo contains device emulation parameters.
type DispatchEventResult ¶
type DispatchEventResult struct {
Dispatched bool `json:"dispatched"`
EventType string `json:"eventType"`
Selector string `json:"selector"`
}
DispatchEventResult contains the result of dispatching a custom event.
type ElementLayout ¶
type ElementLayout struct {
Selector string `json:"selector"`
TagName string `json:"tagName"`
Bounds *BoundingBox `json:"bounds"`
Styles map[string]string `json:"styles,omitempty"`
Children []ElementLayout `json:"children,omitempty"`
}
ElementLayout contains comprehensive layout information for an element.
type EntryPreview ¶ added in v1.9.0
type EntryPreview struct {
Key *ObjectPreview `json:"key,omitempty"`
Value ObjectPreview `json:"value"`
}
EntryPreview is a Map/Set entry in a preview.
type EvalResult ¶
type EvalResult struct {
Value interface{} `json:"value"`
Type string `json:"type,omitempty"`
}
EvalResult contains the result of evaluating a JavaScript expression.
type EventListenerInfo ¶
type EventListenerInfo struct {
Type string `json:"type"`
UseCapture bool `json:"useCapture"`
Passive bool `json:"passive"`
Once bool `json:"once"`
ScriptID string `json:"scriptId,omitempty"`
LineNumber int `json:"lineNumber"`
ColumnNumber int `json:"columnNumber"`
}
EventListenerInfo contains information about an event listener.
type EventListenersResult ¶
type EventListenersResult struct {
Listeners []EventListenerInfo `json:"listeners"`
}
EventListenersResult contains the list of event listeners on an element.
type ExceptionInfo ¶
type ExceptionInfo struct {
Text string `json:"text"`
LineNumber int `json:"lineNumber,omitempty"`
ColumnNumber int `json:"columnNumber,omitempty"`
URL string `json:"url,omitempty"`
}
ExceptionInfo represents a JavaScript exception.
type FindResult ¶
type FindResult struct {
Text string `json:"text"`
Count int `json:"count"`
Found bool `json:"found"`
}
FindResult represents the result of finding text on the page.
type FormInfo ¶
type FormInfo struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Action string `json:"action,omitempty"`
Method string `json:"method,omitempty"`
Inputs []InputInfo `json:"inputs"`
}
FormInfo contains information about a form on the page.
type FrameInfo ¶
type FrameInfo struct {
ID string `json:"id"`
ParentID string `json:"parentId,omitempty"`
Name string `json:"name,omitempty"`
URL string `json:"url"`
}
FrameInfo contains information about a frame.
type HARContent ¶
HARContent represents the response body content.
type HARCreator ¶
HARCreator represents the creator of the HAR file.
type HAREntry ¶
type HAREntry struct {
StartedDateTime string `json:"startedDateTime"`
Time float64 `json:"time"`
Request HARRequest `json:"request"`
Response HARResponse `json:"response"`
Cache struct{} `json:"cache"`
Timings HARTimings `json:"timings"`
}
HAREntry represents a single HTTP transaction.
type HARLog ¶
type HARLog struct {
Log struct {
Version string `json:"version"`
Creator HARCreator `json:"creator"`
Entries []HAREntry `json:"entries"`
} `json:"log"`
}
HARLog represents an HTTP Archive log.
type HARRequest ¶
type HARRequest struct {
Method string `json:"method"`
URL string `json:"url"`
HTTPVersion string `json:"httpVersion"`
Headers []HARHeader `json:"headers"`
QueryString []HARQuery `json:"queryString"`
HeadersSize int `json:"headersSize"`
BodySize int `json:"bodySize"`
}
HARRequest represents an HTTP request.
type HARResponse ¶
type HARResponse struct {
Status int `json:"status"`
StatusText string `json:"statusText"`
HTTPVersion string `json:"httpVersion"`
Headers []HARHeader `json:"headers"`
Content HARContent `json:"content"`
RedirectURL string `json:"redirectURL"`
HeadersSize int `json:"headersSize"`
BodySize int `json:"bodySize"`
}
HARResponse represents an HTTP response.
type HARTimings ¶
type HARTimings struct {
Send float64 `json:"send"`
Wait float64 `json:"wait"`
Receive float64 `json:"receive"`
}
HARTimings represents the timing information.
type HeapSnapshotResult ¶
HeapSnapshotResult contains metadata about a captured heap snapshot.
type ImageInfo ¶
type ImageInfo struct {
Src string `json:"src"`
Alt string `json:"alt,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Loading string `json:"loading,omitempty"`
}
ImageInfo contains information about an image element.
type InputInfo ¶
type InputInfo struct {
Name string `json:"name,omitempty"`
Type string `json:"type"`
ID string `json:"id,omitempty"`
Value string `json:"value,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Required bool `json:"required,omitempty"`
}
InputInfo contains information about a form input.
type InterceptConfig ¶
type InterceptConfig struct {
URLPattern string // URL pattern to match (e.g., "*", "*.js", "https://example.com/*")
InterceptResponse bool // If true, intercept responses; if false, intercept requests
Replacements map[string]string // Text replacements to apply (old -> new)
ResponseBody string // Override response body entirely (if set, Replacements ignored)
StatusCode int // Override status code (0 = use original)
Headers map[string]string // Override/add headers
}
InterceptConfig configures request/response interception.
type KeyModifiers ¶
KeyModifiers represents keyboard modifier keys.
type MediaFeatures ¶
type MediaFeatures struct {
ColorScheme string // "light", "dark", or "" for no preference
ReducedMotion string // "reduce", "no-preference", or "" for no preference
ForcedColors string // "active", "none", or "" for no preference
}
MediaFeatures represents CSS media features to emulate.
type MouseMoveResult ¶
MouseMoveResult represents the result of moving the mouse.
type NavigateResult ¶
type NavigateResult struct {
}
NavigateResult contains the result of a navigation.
type NetworkConditions ¶
type NetworkConditions struct {
Offline bool `json:"offline"`
Latency float64 `json:"latency"` // Milliseconds
DownloadThroughput float64 `json:"downloadThroughput"` // Bytes per second (-1 = disabled)
UploadThroughput float64 `json:"uploadThroughput"` // Bytes per second (-1 = disabled)
}
NetworkConditions represents network throttling settings.
type NetworkEvent ¶
type NetworkEvent struct {
Type string `json:"type"` // "request" or "response"
RequestID string `json:"requestId"` // unique identifier for matching request/response
URL string `json:"url"`
Method string `json:"method,omitempty"` // HTTP method (requests only)
Status int `json:"status,omitempty"` // HTTP status code (responses only)
MimeType string `json:"mimeType,omitempty"` // MIME type (responses only)
}
NetworkEvent represents a network request or response event.
type ObjectPreview ¶ added in v1.9.0
type ObjectPreview struct {
Type string `json:"type"`
Subtype string `json:"subtype,omitempty"`
Description string `json:"description,omitempty"`
Properties []PropertyPreview `json:"properties"`
Overflow bool `json:"overflow"` // true if truncated
Entries []EntryPreview `json:"entries,omitempty"` // for Map/Set
}
ObjectPreview is a snapshot of an object's properties taken at log time.
type PDFOptions ¶
type PDFOptions struct {
Landscape bool `json:"landscape,omitempty"`
PrintBackground bool `json:"printBackground,omitempty"`
Scale float64 `json:"scale,omitempty"`
PaperWidth float64 `json:"paperWidth,omitempty"` // inches
PaperHeight float64 `json:"paperHeight,omitempty"` // inches
MarginTop float64 `json:"marginTop,omitempty"` // inches
MarginBottom float64 `json:"marginBottom,omitempty"`
MarginLeft float64 `json:"marginLeft,omitempty"`
MarginRight float64 `json:"marginRight,omitempty"`
PageRanges string `json:"pageRanges,omitempty"` // e.g. "1-5, 8"
PreferCSSPageSize bool `json:"preferCSSPageSize,omitempty"`
}
PDFOptions configures PDF generation.
type PageInfo ¶
type PageInfo struct {
Title string `json:"title"`
URL string `json:"url"`
ReadyState string `json:"readyState"`
CharacterSet string `json:"characterSet"`
ContentType string `json:"contentType"`
}
PageInfo represents combined information about the current page.
type PinchResult ¶
type PinchResult struct {
Pinched bool `json:"pinched"`
Direction string `json:"direction"`
Selector string `json:"selector"`
}
PinchResult contains the result of a pinch gesture.
type PropertyDescriptor ¶ added in v1.9.0
type PropertyDescriptor struct {
Name string `json:"name"`
Value *RemoteObject `json:"value,omitempty"`
Writable bool `json:"writable,omitempty"`
Configurable bool `json:"configurable,omitempty"`
Enumerable bool `json:"enumerable,omitempty"`
IsOwn bool `json:"isOwn,omitempty"`
}
PropertyDescriptor describes a property returned by Runtime.getProperties.
type PropertyPreview ¶ added in v1.9.0
type PropertyPreview struct {
Name string `json:"name"`
Type string `json:"type"`
Value string `json:"value,omitempty"`
Subtype string `json:"subtype,omitempty"`
ValuePreview *ObjectPreview `json:"valuePreview,omitempty"` // nested preview for object values
}
PropertyPreview is a single property in an object preview.
type ProtocolError ¶
ProtocolError represents an error returned by the Chrome DevTools Protocol.
func (*ProtocolError) Error ¶
func (e *ProtocolError) Error() string
func (*ProtocolError) Unwrap ¶
func (e *ProtocolError) Unwrap() error
type QueryResult ¶
type QueryResult struct {
NodeID int `json:"nodeId"`
TagName string `json:"tagName,omitempty"`
Attributes map[string]string `json:"attributes,omitempty"`
}
QueryResult contains the result of querying for a DOM element.
type RecordedEvent ¶
type RecordedEvent struct {
Type string `json:"type"` // "navigate", "click", etc.
URL string `json:"url,omitempty"`
}
RecordedEvent represents a recorded browser event.
type RemoteObject ¶ added in v1.9.0
type RemoteObject struct {
Type string `json:"type"` // "object", "string", "number", "boolean", "undefined", "function", "symbol", "bigint"
Subtype string `json:"subtype,omitempty"` // "array", "null", "date", "regexp", "map", "set", "promise", "error", etc.
ClassName string `json:"className,omitempty"` // constructor name
Description string `json:"description,omitempty"` // string representation
ObjectID string `json:"objectId,omitempty"` // handle for getProperties (empty for primitives)
Value interface{} `json:"value,omitempty"` // primitive value
UnserializableValue string `json:"unserializableValue,omitempty"` // Infinity, -0, NaN, -Infinity, bigint literals
Preview *ObjectPreview `json:"preview,omitempty"` // shallow property snapshot
}
RemoteObject represents a JavaScript value with optional remote reference.
type ResponseBodyResult ¶
type ResponseBodyResult struct {
Body string `json:"body"`
Base64Encoded bool `json:"base64Encoded"`
}
ResponseBodyResult contains the response body for a network request.
type ScreenshotOptions ¶
type ScreenshotOptions struct {
Format string // "png", "jpeg", "webp"
Quality int // 0-100, only for jpeg/webp
}
ScreenshotOptions configures screenshot capture.
type ScreenshotResult ¶
ScreenshotResult contains metadata about a captured screenshot.
type ScriptCoverage ¶
type ScriptCoverage struct {
ScriptID string `json:"scriptId"`
URL string `json:"url"`
Ranges []CoverageRange `json:"ranges"`
}
ScriptCoverage represents coverage for a single script.
type ScriptInfo ¶
type ScriptInfo struct {
Src string `json:"src"`
Type string `json:"type"`
Async bool `json:"async"`
Defer bool `json:"defer"`
Inline bool `json:"inline"`
}
ScriptInfo represents information about a script element.
type ScriptsResult ¶
type ScriptsResult struct {
Scripts []ScriptInfo `json:"scripts"`
}
ScriptsResult represents all scripts on the page.
type SelectionResult ¶
type SelectionResult struct {
Text string `json:"text"`
}
SelectionResult contains the currently selected text on the page.
type SetValueResult ¶
SetValueResult represents the result of setting an input value.
type StylesheetInfo ¶
type StylesheetInfo struct {
StyleSheetID string `json:"styleSheetId"`
SourceURL string `json:"sourceURL"`
Title string `json:"title"`
Disabled bool `json:"disabled"`
IsInline bool `json:"isInline"`
Length int `json:"length"`
}
StylesheetInfo represents information about a stylesheet.
type StylesheetsResult ¶
type StylesheetsResult struct {
Stylesheets []StylesheetInfo `json:"stylesheets"`
}
StylesheetsResult represents all stylesheets on the page.
type SwipeResult ¶
type SwipeResult struct {
Swiped bool `json:"swiped"`
Direction string `json:"direction"`
Selector string `json:"selector"`
}
SwipeResult contains the result of a swipe gesture.
type TargetInfo ¶
type TargetInfo struct {
ID string `json:"id"`
Type string `json:"type"`
Title string `json:"title"`
URL string `json:"url"`
}
TargetInfo contains information about a browser target (tab/page).
type TraceResult ¶
TraceResult contains metadata about a captured trace.
type VersionInfo ¶
type VersionInfo struct {
Browser string `json:"browser"`
ProtocolVersion string `json:"protocol"`
UserAgent string `json:"userAgent,omitempty"`
V8Version string `json:"v8,omitempty"`
}
VersionInfo contains browser version information.