Documentation
¶
Index ¶
- type Session
- func (s *Session) ClickAt(x, y int) error
- func (s *Session) ClickDrag(fromX, fromY, toX, toY int) error
- func (s *Session) Close() error
- func (s *Session) DoubleClickAt(x, y int) error
- func (s *Session) GetURL() (string, error)
- func (s *Session) GoBack() error
- func (s *Session) GoForward() error
- func (s *Session) HoverAt(x, y int) error
- func (s *Session) Key(keys ...string) error
- func (s *Session) MiddleClickAt(x, y int) error
- func (s *Session) MouseDown(x, y int) error
- func (s *Session) MouseMove(x, y int) error
- func (s *Session) MouseUp(x, y int) error
- func (s *Session) Navigate(url string) error
- func (s *Session) RightClickAt(x, y int) error
- func (s *Session) Screenshot() ([]byte, error)
- func (s *Session) Scroll(direction string, amount int) error
- func (s *Session) ScrollAt(x, y int, direction string, magnitude int) error
- func (s *Session) Search() error
- func (s *Session) TripleClickAt(x, y int) error
- func (s *Session) TypeText(text string) error
- func (s *Session) TypeTextAt(x, y int, text string, clearBefore, pressEnter bool) error
- type SessionConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session represents a browser automation session
func NewSession ¶
func NewSession(ctx context.Context, config SessionConfig) (*Session, error)
NewSession creates a new browser session with the given configuration
func (*Session) ClickDrag ¶
ClickDrag performs a click and drag operation from one coordinate to another
func (*Session) DoubleClickAt ¶
DoubleClickAt performs a double click at the specified coordinates
func (*Session) Key ¶
Key presses a key or key combination Examples: Key("Enter"), Key("Control", "C"), Key("Alt", "F4")
func (*Session) MiddleClickAt ¶
MiddleClickAt performs a middle click at the specified coordinates
func (*Session) RightClickAt ¶
RightClickAt performs a right click at the specified coordinates
func (*Session) Screenshot ¶
Screenshot captures the current browser viewport as a PNG image Returns the PNG image data as a byte slice
func (*Session) Scroll ¶
Scroll scrolls the page in the specified direction by the given amount direction: "up", "down", "left", "right" amount: scroll distance (in pixels if not normalized, or 0-999 if normalized)
func (*Session) ScrollAt ¶
ScrollAt scrolls at a specific location on the page x, y: coordinates to scroll at direction: "up", "down", "left", "right" magnitude: scroll amount (0-999 if normalized, pixels otherwise)
func (*Session) TripleClickAt ¶
TripleClickAt performs a triple click at the specified coordinates
type SessionConfig ¶
type SessionConfig struct {
ScreenWidth int // Browser viewport width
ScreenHeight int // Browser viewport height
NormalizeCoordinates bool // If true, use 0-999 grid; if false, use pixels
InitialURL string // Starting URL (default: "https://www.google.com")
SearchEngineURL string // URL for Search() action (default: "https://www.google.com")
Headless bool // Run browser in headless mode
}
SessionConfig holds configuration for a browser session