playwright

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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) Click

func (l *Locator) Click(timeout time.Duration) error

Click clicks on the first matching element.

func (*Locator) Count

func (l *Locator) Count() (int, error)

Count returns the number of matching elements.

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) Close

func (p *Page) Close() error

Close closes the page.

func (*Page) Content

func (p *Page) Content() (string, error)

Content returns the full HTML content of the page.

func (*Page) Eval

func (p *Page) Eval(js string, args ...any) (any, error)

Eval executes JavaScript in the page context and returns the result.

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

func (p *Page) OnRequest(handler func(url string, headers map[string]string))

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

func (p *Page) OnResponse(handler func(url string, statusCode int, headers map[string]string))

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

func (p *Page) Screenshot(fullPage bool) ([]byte, error)

Screenshot takes a screenshot of the page.

func (*Page) URL

func (p *Page) URL() string

URL returns the current page URL.

func (*Page) Unwrap

func (p *Page) Unwrap() any

Unwrap returns the underlying playwright.Page.

func (*Page) WaitForSelector

func (p *Page) WaitForSelector(selector string, timeout time.Duration) error

WaitForSelector waits for an element matching the selector to appear.

func (*Page) WaitForTimeout

func (p *Page) WaitForTimeout(timeout time.Duration)

WaitForTimeout waits for the specified duration. Note: This is generally discouraged in favor of waiting for specific conditions.

func (*Page) WaitForURL

func (p *Page) WaitForURL(url string, timeout time.Duration) error

WaitForURL waits until the page URL matches the given pattern.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL