Documentation
¶
Index ¶
- type Locator
- type Page
- func (p *Page) ClearNetworkHooks()
- func (p *Page) Close() error
- func (p *Page) Content() (string, error)
- func (p *Page) Eval(js string, args ...any) (any, error)
- func (p *Page) Goto(url string, waitUntil scrapemate.WaitUntilState) (*scrapemate.PageResponse, error)
- func (p *Page) Locator(selector string) scrapemate.Locator
- func (p *Page) OnRequest(handler func(url string, headers map[string]string))
- func (p *Page) OnResponse(handler func(url string, statusCode int, headers map[string]string))
- func (p *Page) Reload(waitUntil scrapemate.WaitUntilState) error
- func (p *Page) Screenshot(fullPage bool) ([]byte, error)
- func (p *Page) URL() string
- func (p *Page) Unwrap() any
- func (p *Page) WaitForSelector(selector string, timeout time.Duration) error
- func (p *Page) WaitForTimeout(timeout time.Duration)
- func (p *Page) WaitForURL(url string, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Locator ¶
type Locator struct {
// contains filtered or unexported fields
}
Locator wraps a playwright.Locator and implements scrapemate.Locator.
func (*Locator) First ¶
func (l *Locator) First() scrapemate.Locator
First returns a locator for the first matching element.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
Page wraps a playwright.Page and implements scrapemate.BrowserPage.
func NewPage ¶
func NewPage(page playwright.Page) *Page
NewPage creates a new Page wrapper around a playwright.Page.
func (*Page) ClearNetworkHooks ¶ added in v1.2.1
func (p *Page) ClearNetworkHooks()
ClearNetworkHooks removes request and response handlers registered through this wrapper. It leaves any listeners registered directly on the underlying Playwright page untouched.
func (*Page) Goto ¶
func (p *Page) Goto(url string, waitUntil scrapemate.WaitUntilState) (*scrapemate.PageResponse, error)
Goto navigates to a URL and waits for the specified state.
func (*Page) Locator ¶
func (p *Page) Locator(selector string) scrapemate.Locator
Locator creates a locator for finding elements matching the selector.
func (*Page) OnRequest ¶ added in v1.2.1
OnRequest implements scrapemate.RequestHookProvider. The handler is called for every outgoing request with the request URL and a lower-cased header map.
func (*Page) OnResponse ¶ added in v1.2.1
OnResponse implements scrapemate.RequestHookProvider. The handler is called for every response with the response URL, status code and a lower-cased header map.
func (*Page) Reload ¶
func (p *Page) Reload(waitUntil scrapemate.WaitUntilState) error
Reload reloads the current page.
func (*Page) Screenshot ¶
Screenshot takes a screenshot of the page.
func (*Page) WaitForSelector ¶
WaitForSelector waits for an element matching the selector to appear.
func (*Page) WaitForTimeout ¶
WaitForTimeout waits for the specified duration. Note: This is generally discouraged in favor of waiting for specific conditions.