Documentation
¶
Index ¶
- type BrowserPage
- func (b *BrowserPage) CloseBrowserPage()
- func (b *BrowserPage) FindNavigations() ([]*types.Action, error)
- func (b *BrowserPage) GetAllElements(selector string) ([]*types.HTMLElement, error)
- func (b *BrowserPage) GetAllForms() ([]*types.HTMLForm, error)
- func (b *BrowserPage) GetElementFromXpath(xpath string) (*types.HTMLElement, error)
- func (b *BrowserPage) GetEventListeners() ([]*types.EventListener, error)
- func (b *BrowserPage) GetNavigatedLinks() ([]*NavigatedLink, error)
- func (p *BrowserPage) WaitNewStable(d time.Duration) error
- func (b *BrowserPage) WaitPageLoadHeurisitics() error
- func (b *BrowserPage) WaitPageLoadHeuristicsFallback() error
- type Launcher
- type LauncherOptions
- type NavigatedLink
- type ScopeValidator
- type WaitOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrowserPage ¶
type BrowserPage struct {
*rod.Page
Browser *rod.Browser
// contains filtered or unexported fields
}
BrowserPage is a combination of a browser and a page
func (*BrowserPage) CloseBrowserPage ¶
func (b *BrowserPage) CloseBrowserPage()
func (*BrowserPage) FindNavigations ¶
func (b *BrowserPage) FindNavigations() ([]*types.Action, error)
FindNavigation attempts to find more navigations on the page which could be done to find more links and pages.
This includes the following -
- Forms
- Buttons
- Links
- Elements with event listeners
The navigations found are unique across the page. The caller needs to ensure they are unique globally before doing further actions with details.
func (*BrowserPage) GetAllElements ¶
func (b *BrowserPage) GetAllElements(selector string) ([]*types.HTMLElement, error)
func (*BrowserPage) GetAllForms ¶
func (b *BrowserPage) GetAllForms() ([]*types.HTMLForm, error)
func (*BrowserPage) GetElementFromXpath ¶
func (b *BrowserPage) GetElementFromXpath(xpath string) (*types.HTMLElement, error)
func (*BrowserPage) GetEventListeners ¶
func (b *BrowserPage) GetEventListeners() ([]*types.EventListener, error)
GetEventListeners returns all event listeners on the page
func (*BrowserPage) GetNavigatedLinks ¶
func (b *BrowserPage) GetNavigatedLinks() ([]*NavigatedLink, error)
GetNavigatedLinks returns all navigated links on the page
func (*BrowserPage) WaitNewStable ¶
func (p *BrowserPage) WaitNewStable(d time.Duration) error
WaitStable waits until the page is stable for d duration.
func (*BrowserPage) WaitPageLoadHeurisitics ¶
func (b *BrowserPage) WaitPageLoadHeurisitics() error
WaitPageLoadHeurisitics waits for the page to load using multiple heuristics. Strategy order:
- Wait for initial load event (covers classic navigation & first paint).
- Poll for a URL change – the strongest signal on SPAs with client-side routing.
- If URL changes, wait a short grace period + network-idle window.
- If URL doesn't change, fall back to network-idle + DOM-stable windows.
This keeps fast pages fast while still succeeding on noisy, long-running SPAs.
func (*BrowserPage) WaitPageLoadHeuristicsFallback ¶
func (b *BrowserPage) WaitPageLoadHeuristicsFallback() error
WaitPageLoadHeuristicsFallback provides the enhanced timeouts for complex navigation
type Launcher ¶
type Launcher struct {
// contains filtered or unexported fields
}
Launcher is a high level controller to launch browsers and do the execution on them.
func NewLauncher ¶
func NewLauncher(opts LauncherOptions) (*Launcher, error)
NewLauncher returns a new launcher instance
func (*Launcher) GetPageFromPool ¶
func (l *Launcher) GetPageFromPool() (*BrowserPage, error)
GetPageFromPool returns a page from the pool
func (*Launcher) PutBrowserToPool ¶
func (l *Launcher) PutBrowserToPool(browser *BrowserPage)
func (*Launcher) ScopeValidator ¶
func (l *Launcher) ScopeValidator() ScopeValidator
type LauncherOptions ¶
type LauncherOptions struct {
ChromiumPath string
MaxBrowsers int
PageMaxTimeout time.Duration
ShowBrowser bool
NoSandbox bool
Proxy string
SlowMotion bool
Trace bool
CookieConsentBypass bool
ChromeUser *user.User // optional chrome user to use
ScopeValidator ScopeValidator
RequestCallback func(*output.Result)
}
LauncherOptions contains options for the launcher
type NavigatedLink ¶
type NavigatedLink struct {
}
NavigatedLink is a link navigated collected from one of the navigation hooks.
type ScopeValidator ¶
type WaitOptions ¶
type WaitOptions struct {
URLPollInterval time.Duration // interval between successive URL polls
URLPollTimeout time.Duration // how long to keep polling before giving up on URL change
PostChangeWait time.Duration // small grace period after URL change for late requests
IdleWait time.Duration // network-idle window when no URL change happened
DOMStableWait time.Duration // DOM-stable window (used after idle)
MaxTimeout time.Duration // absolute upper bound for all waiting
}
WaitOptions controls how WaitPageLoadHeurisitics determines navigation completion. All durations are conservative defaults and can be tuned later via package-level variables or future setter methods (kept simple here to avoid breaking public API).