Documentation
¶
Overview ¶
Package rustwright provides a Go wrapper for the Rustwright C ABI.
Index ¶
- func Bool(v bool) *bool
- func DefaultLibraryPath() string
- type ActionOptions
- type Browser
- type Chromium
- type Clip
- type CloseOptions
- type EvaluateOptions
- type GotoOptions
- type JavaScriptError
- type LaunchOptions
- type Page
- func (p *Page) Click(selector string, options *ActionOptions) error
- func (p *Page) Close(options *CloseOptions) error
- func (p *Page) Evaluate(expression string, arg any, options *EvaluateOptions) (any, error)
- func (p *Page) Fill(selector, value string, options *ActionOptions) error
- func (p *Page) Goto(rawURL string, options *GotoOptions) (any, error)
- func (p *Page) Screenshot(options *ScreenshotOptions) ([]byte, error)
- func (p *Page) TargetID() (string, error)
- func (p *Page) TextContent(selector string, options *ActionOptions) (*string, error)
- func (p *Page) Title(options *ActionOptions) (string, error)
- type ProxyOptions
- type RegExpValue
- type ScreenshotOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLibraryPath ¶
func DefaultLibraryPath() string
DefaultLibraryPath returns the default path relative to the repository root. Run from the repository root, set RUSTWRIGHT_LIB, or pass a path to Open to choose another exact library.
Types ¶
type ActionOptions ¶
type ActionOptions struct {
Timeout *float64
}
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
func (*Browser) WSEndpoint ¶
type Chromium ¶
type Chromium struct {
// contains filtered or unexported fields
}
Chromium is a loaded Rustwright library and its Chromium entrypoint.
func (*Chromium) ExecutablePath ¶
type CloseOptions ¶
type EvaluateOptions ¶
type EvaluateOptions struct {
Timeout *float64
}
type GotoOptions ¶
type JavaScriptError ¶
type JavaScriptError struct {
Name string `json:"name,omitempty"`
Message string `json:"message,omitempty"`
Stack string `json:"stack,omitempty"`
}
JavaScriptError is the native representation of an evaluated Error object.
func (JavaScriptError) Error ¶
func (e JavaScriptError) Error() string
type LaunchOptions ¶
type LaunchOptions struct {
Headless *bool
ExecutablePath string
Channel string
Args []string
IgnoreAllDefaultArgs bool
IgnoreDefaultArgs []string
Timeout *float64
UserDataDir string
Env map[string]string
ChromiumSandbox bool
Proxy *ProxyOptions
}
LaunchOptions uses idiomatic camel-case Go fields and is normalized to the C core's snake_case JSON wire format.
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
func (*Page) Close ¶
func (p *Page) Close(options *CloseOptions) error
Close closes the page and then frees its opaque handle exactly once.
func (*Page) Evaluate ¶
Evaluate encodes arg as one JSON value. A nil arg means the optional ABI argument is absent; JavaScript null can be sent with json.RawMessage("null").
func (*Page) Screenshot ¶
func (p *Page) Screenshot(options *ScreenshotOptions) ([]byte, error)
func (*Page) TextContent ¶
func (p *Page) TextContent(selector string, options *ActionOptions) (*string, error)
type ProxyOptions ¶
type RegExpValue ¶
RegExpValue preserves a JavaScript regular expression's source and flags.
type ScreenshotOptions ¶
type ScreenshotOptions struct {
Path string `json:"path,omitempty"`
FullPage bool `json:"fullPage,omitempty"`
Clip *Clip `json:"clip,omitempty"`
Timeout *float64 `json:"timeout,omitempty"`
Type string `json:"type,omitempty"`
Quality *int `json:"quality,omitempty"`
OmitBackground bool `json:"omitBackground,omitempty"`
}