Documentation
¶
Index ¶
- type BrowserSession
- type ExtractOpts
- type Manager
- type NavigateOpts
- type NetworkPolicy
- type PDFOpts
- type PDFResult
- type PlaywrightManager
- func (m *PlaywrightManager) Click(ctx context.Context, sessionID uuid.UUID, selector string) error
- func (m *PlaywrightManager) Close(ctx context.Context, sessionID uuid.UUID) error
- func (m *PlaywrightManager) Evaluate(ctx context.Context, sessionID uuid.UUID, jsScript string) (interface{}, error)
- func (m *PlaywrightManager) Extract(ctx context.Context, sessionID uuid.UUID, opts ExtractOpts) (string, error)
- func (m *PlaywrightManager) Fill(ctx context.Context, sessionID uuid.UUID, selector, value string) error
- func (m *PlaywrightManager) Navigate(ctx context.Context, sessionID uuid.UUID, targetURL string, opts NavigateOpts) error
- func (m *PlaywrightManager) PDF(ctx context.Context, sessionID uuid.UUID, opts PDFOpts) (*PDFResult, error)
- func (m *PlaywrightManager) Screenshot(ctx context.Context, sessionID uuid.UUID, opts ScreenshotOpts) (*ScreenshotResult, error)
- func (m *PlaywrightManager) Wait(ctx context.Context, sessionID uuid.UUID, opts WaitOpts) error
- type ScreenshotOpts
- type ScreenshotResult
- type WaitOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrowserSession ¶
type BrowserSession struct {
SessionID uuid.UUID
CreatedAt time.Time
LastUsed time.Time
PageCount int
}
BrowserSession tracks browser state for a session
type ExtractOpts ¶
type ExtractOpts struct {
Selector string // CSS selector (empty = entire page)
Extract string // "text", "html", "attributes"
}
ExtractOpts configures content extraction
type Manager ¶
type Manager interface {
Navigate(ctx context.Context, sessionID uuid.UUID, url string, opts NavigateOpts) error
// Take a screenshot
Screenshot(ctx context.Context, sessionID uuid.UUID, opts ScreenshotOpts) (*ScreenshotResult, error)
// Click an element
Click(ctx context.Context, sessionID uuid.UUID, selector string) error
// Fill an input field
Fill(ctx context.Context, sessionID uuid.UUID, selector, value string) error
// Extract content from the page
Extract(ctx context.Context, sessionID uuid.UUID, opts ExtractOpts) (string, error)
// Evaluate JavaScript
Evaluate(ctx context.Context, sessionID uuid.UUID, script string) (interface{}, error)
// Wait for an element or condition
Wait(ctx context.Context, sessionID uuid.UUID, opts WaitOpts) error
// Generate a PDF
PDF(ctx context.Context, sessionID uuid.UUID, opts PDFOpts) (*PDFResult, error)
// Close browser resources for a session
Close(ctx context.Context, sessionID uuid.UUID) error
}
Manager provides browser automation capabilities for VaultRun sessions
type NetworkPolicy ¶
type NetworkPolicy struct {
AllowedHosts []string
BlockPrivateIPs bool
BlockLocalhost bool
BlockMetadata bool // Block cloud metadata endpoints (169.254.169.254, etc.)
}
NetworkPolicy defines allowed/blocked URLs for browser navigation
func DefaultNetworkPolicy ¶
func DefaultNetworkPolicy() *NetworkPolicy
DefaultNetworkPolicy returns a secure default policy
type PlaywrightManager ¶
type PlaywrightManager struct {
// contains filtered or unexported fields
}
PlaywrightManager implements Manager using Playwright via Docker exec
func (*PlaywrightManager) Evaluate ¶
func (m *PlaywrightManager) Evaluate(ctx context.Context, sessionID uuid.UUID, jsScript string) (interface{}, error)
Evaluate runs JavaScript in the browser
func (*PlaywrightManager) Extract ¶
func (m *PlaywrightManager) Extract(ctx context.Context, sessionID uuid.UUID, opts ExtractOpts) (string, error)
Extract extracts content from the page
func (*PlaywrightManager) Fill ¶
func (m *PlaywrightManager) Fill(ctx context.Context, sessionID uuid.UUID, selector, value string) error
Fill fills an input field
func (*PlaywrightManager) Navigate ¶
func (m *PlaywrightManager) Navigate(ctx context.Context, sessionID uuid.UUID, targetURL string, opts NavigateOpts) error
Navigate navigates to a URL
func (*PlaywrightManager) PDF ¶
func (m *PlaywrightManager) PDF(ctx context.Context, sessionID uuid.UUID, opts PDFOpts) (*PDFResult, error)
PDF generates a PDF of the current page
func (*PlaywrightManager) Screenshot ¶
func (m *PlaywrightManager) Screenshot(ctx context.Context, sessionID uuid.UUID, opts ScreenshotOpts) (*ScreenshotResult, error)
Screenshot captures a screenshot
type ScreenshotOpts ¶
type ScreenshotOpts struct {
FullPage bool // Capture entire page (not just viewport)
Selector string // Screenshot specific element only
Format string // "png" or "jpeg"
}
ScreenshotOpts configures screenshot capture
type ScreenshotResult ¶
ScreenshotResult contains screenshot artifact info