Skip to main content
Module

x/astral/mod.ts>ElementHandle

A high-level puppeteer/playwright-like library for Deno
Go to Latest
class ElementHandle
Re-export
import { ElementHandle } from "https://deno.land/x/astral@0.2.1/mod.ts";

ElementHandle represents an in-page DOM element.

Constructors

new
ElementHandle(
id: number,
celestial: Celestial,
page: Page,
)

Methods

$(selector: string)

Queries the current element for an element matching the given selector.

$$(selector: string)

Queries the current element for all elements matching the given selector.

boundingBox(): Promise<BoundingBox | null>

This method returns boxes of the element, or null if the element is not visible.

boxModel(): Promise<BoxModel | null>

This method returns boxes of the element, or null if the element is not visible.

click(opts?: { offset?: Offset; })

This method scrolls element into view if needed, and then uses Page.mouse to click in the center of the element.

Calls focus on the element.

screenshot(opts?: Omit<ScreenshotOptions, "clip">)

This method scrolls element into view if needed, and then uses Page.screenshot() to take a screenshot of the element.

Scrolls the element into view using the automation protocol client.

type(text: string, opts?: KeyboardTypeOptions)

Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.

waitForSelector(selector: string)

Wait for an element matching the given selector to appear in the current element.