allwright

API ReferenceRustPage

Page

Page is Tab under a type alias. Every action here also has a *_with_options twin (e.g. click_with_options) that accepts the same call plus a typed Options struct — shown once here, favoring the fuller signature. Tab::locator(...) and the get_by_* builders under Locator are also implemented directly on Tab.

click

MethodSince v0.0.14

Clicks the first matching element; click(...) omits options for the default timeout.

pub async fn click_with_options(&self, css_selector: impl Into<String>, options: CommandOptions) -> Result<ClickResult>

Example

page.click("a[target=_blank]").await?;

fill

MethodSince v0.0.14

Sets an input/textarea's value; fill(...) omits options for the default timeout.

pub async fn fill_with_options(&self, css_selector: impl Into<String>, value: impl Into<String>, options: CommandOptions) -> Result<FillResult>

hover

MethodSince v0.0.14

Hovers the pointer over the matching element; hover(...) omits options for the default timeout.

pub async fn hover_with_options(&self, css_selector: impl Into<String>, options: CommandOptions) -> Result<ElementResult>

press

MethodSince v0.0.14

Sends a key press to the matching element, optionally typing PressOptions.text; press(...) omits options.

pub async fn press_with_options(&self, css_selector: impl Into<String>, key: impl Into<String>, options: PressOptions) -> Result<PressResult>

focus

MethodSince v0.0.14

Focuses the matching element; focus(...) omits options for the default timeout.

pub async fn focus_with_options(&self, css_selector: impl Into<String>, options: CommandOptions) -> Result<ElementResult>

highlight

MethodSince v0.0.14

Visually highlights matching elements for a duration — a debugging aid; highlight(...) omits options.

pub async fn highlight_with_options(&self, css_selector: impl Into<String>, options: HighlightOptions) -> Result<HighlightResult>

count

MethodSince v0.0.14

Returns how many elements match the selector; count(...) omits options for the default timeout.

pub async fn count_with_options(&self, css_selector: impl Into<String>, options: CommandOptions) -> Result<CountResult>

text_content / inner_text

MethodSince v0.0.14

Reads the raw textContent, or (via inner_text) the rendered innerText, of the matching element.

pub async fn text_content_with_options(&self, css_selector: impl Into<String>, options: CommandOptions) -> Result<TextResult>

Example

page.text_content(selector).await?;

wait_for_selector

MethodSince v0.0.14

Waits, retrying, until the selector matches — WaitForSelectorOptions.visible optionally requires visibility.

pub async fn wait_for_selector_with_options(&self, css_selector: impl Into<String>, options: WaitForSelectorOptions) -> Result<WaitForSelectorResult>

Example

page.wait_for_selector_with_options(selector, WaitForSelectorOptions { visible: Some(true), timeout_ms: Some(10_000) }).await?;

screenshot

MethodSince v0.0.54 – v0.0.55

Captures a PNG screenshot; ScreenshotOptions.full_page captures the whole scrollable page, and .path writes the PNG to disk.

pub async fn screenshot_with_options(&self, options: ScreenshotOptions) -> Result<ScreenshotResult>

accessibility_snapshot

MethodSince v0.1.1

Captures the accessibility tree as JSON or YAML text; AccessibilitySnapshotOptions.mode selects Default, Ai (stable aria-ref per node), Autoexpect, or Codegen.

pub async fn accessibility_snapshot_with_options(&self, options: AccessibilitySnapshotOptions) -> Result<String>

locator

MethodSince v0.0.33

Builds a Locator scoped to this page for a CSS/XPath selector, or use the get_by_* semantic builders documented under Locator.

pub fn locator(&self, css_selector: impl Into<String>) -> Locator

register_hook

MethodSince v0.1.5

Registers a lifecycle hook before the action that triggers it. HookType is sealed — only the provided NEW_PAGE/FILE_CHOOSER/DOWNLOAD tags implement it.

pub async fn register_hook<T: HookType>(&self, hook_type: T) -> Result<Hook<T>>