Quick start click() Click the element matched by this locator. Options that configure this operation. The mouse button to use: "left", "middle", or "right".
The number of clicks to dispatch.
Resolves after the operation completes.
hover() Move the pointer over the matched element. Resolves after the operation completes.
fill() Replace the matched input’s value. Resolves after the operation completes.
count() Count the elements matched by this locator. isChecked() Check whether the matched control is checked. Return the current value of the matched input. isVisible() Check whether the matched element is visible. innerText() Return the rendered text inside the matched element. innerHtml() Return the HTML inside the matched element. textContent() Return the text content of the matched element. Scroll the matched element to a percentage of its range. A percentage from 0 to 100, optionally expressed as a percentage string.
Resolves after the operation completes.
centroid() Return the center point of the matched element. result Promise<LocatorCentroidResult>
The operation result. The horizontal center coordinate.
The vertical center coordinate.
highlight() Temporarily highlight the matched element. Options that configure this operation. The highlight border color. The highlight fill color. How long to display the highlight.
Resolves after the operation completes.
sendClickEvent() Dispatch a DOM click event on the matched element. options LocatorSendClickEventOptions
Options that configure this operation. Whether the event bubbles.
Whether the event can be canceled.
Whether the event crosses shadow DOM boundaries.
The event-specific click detail.
Resolves after the operation completes.
type() Type text into the matched element. Options that configure this operation. The input delay in milliseconds.
Resolves after the operation completes.
selectOption() Select one or more values in the matched select element. The value or values to select.
Set one or more local files or in-memory payloads on the matched <input type="file">. The SDK resolves relative paths on the caller’s machine. Pass an empty array to clear the selection. Local file path(s) or in-memory payload(s) to upload. The SDK serializes each file in memory and limits it to 50 MiB. The filename exposed to the page.
files.buffer ArrayBuffer | Uint8Array | string
The in-memory file content to upload. The SDK base64-encodes it for transport.
The file’s last-modified time in Unix milliseconds.
Resolves after the files are attached.
first() Create a locator for the first matching element. nth() Create a locator for a matching element at a zero-based index. The zero-based match index.
Quick start click() Click the element matched by this locator. button MouseButton | Literal['left', 'right', 'middle']
The mouse button to use: "left", "middle", or "right".
The number of clicks to dispatch.
Resolves after the operation completes.
hover() Move the pointer over the matched element. Resolves after the operation completes.
fill() Replace the matched input’s value. Resolves after the operation completes.
count() Count the elements matched by this locator. is_checked() Check whether the matched control is checked. Return the current value of the matched input. is_visible() Check whether the matched element is visible. inner_text() Return the rendered text inside the matched element. inner_html() Return the HTML inside the matched element. text_content() Return the text content of the matched element. Scroll the matched element to a percentage of its range. A percentage from 0 to 100, optionally expressed as a percentage string.
Resolves after the operation completes.
centroid() Return the center point of the matched element. The operation result. The horizontal center coordinate.
The vertical center coordinate.
highlight() Temporarily highlight the matched element. How long to display the highlight.
The highlight border color. The highlight fill color. Resolves after the operation completes.
send_click_event() Dispatch a DOM click event on the matched element. Whether the event bubbles.
Whether the event can be canceled.
Whether the event crosses shadow DOM boundaries.
Event-specific click detail.
Resolves after the operation completes.
type() Type text into the matched element. Delay between keystrokes, in milliseconds.
Resolves after the operation completes.
select_option() Select one or more values in the matched select element. The value or values to select.
Set one or more local files or in-memory payloads on the matched <input type="file">. The SDK resolves relative paths on the caller’s machine. Pass an empty sequence to clear the selection. files str | Path | FilePayload | Sequence[str | Path | FilePayload]
Local file path(s) or in-memory payload(s) to upload. The SDK serializes each file in memory and limits it to 50 MiB. The filename exposed to the page.
files.buffer bytes | bytearray | memoryview | str
The in-memory file content to upload. The SDK base64-encodes it for transport.
The file’s last-modified time in Unix milliseconds.
Resolves after the files are attached.
first() Create a locator for the first matching element. nth() Create a locator for a matching element at a zero-based index. The zero-based match index.
Quick start In Go the locator type is *stagehand.PageLocator (the wrapper named Locator in the TypeScript and Python SDKs). Every method takes a context.Context first, and methods with options accept a pointer options struct; pass nil for defaults. Click() Click the element matched by this locator. Options that configure this operation. Pass nil for defaults. The mouse button to use: MouseButtonLeft, MouseButtonMiddle, or MouseButtonRight.
The number of clicks to dispatch.
Returns nil after the operation completes.
Hover() Move the pointer over the matched element. Returns nil after the operation completes.
Fill() Replace the matched input’s value. Returns nil after the operation completes.
Count() Count the elements matched by this locator. IsChecked() Check whether the matched control is checked. Return the current value of the matched input. IsVisible() Check whether the matched element is visible. InnerText() Return the rendered text inside the matched element. InnerHTML() Return the HTML inside the matched element. TextContent() Return the text content of the matched element. Scroll the matched element to a percentage of its range. A percentage from 0 to 100. Construct it with stagehand.NumericScrollPercent(50), or with stagehand.NamedScrollPercent("50%") for a percentage string.
Returns nil after the operation completes.
Centroid() Return the center point of the matched element. result (LocatorCentroidResult, error)
The operation result. The horizontal center coordinate.
The vertical center coordinate.
Highlight() Temporarily highlight the matched element. Options that configure this operation. Pass nil for defaults. The highlight border color. The highlight fill color. How long to display the highlight.
Returns nil after the operation completes.
SendClickEvent() Dispatch a DOM click event on the matched element. options *LocatorSendClickEventOptions
Options that configure this operation. Pass nil for defaults. Whether the event bubbles.
Whether the event can be canceled.
Whether the event crosses shadow DOM boundaries.
The event-specific click detail.
Returns nil after the operation completes.
Type() Type text into the matched element. Options that configure this operation. Pass nil for defaults. The input delay in milliseconds.
Returns nil after the operation completes.
SelectOption() Select one or more values in the matched select element. The value or values to select. StringList is a []string.
Set one or more local files or in-memory payloads on the matched <input type="file">. The SDK resolves relative paths on the caller’s machine. Call it without files to clear the selection. Local file path(s) or in-memory payload(s) to upload. Construct each with stagehand.FilePath(path) or stagehand.FileData(name, mimeType, buffer). The SDK serializes each file in memory and limits it to 50 MiB. A path on the SDK caller’s filesystem. Cannot be combined with the payload fields.
The filename exposed to the page.
The in-memory file content to upload. The SDK base64-encodes it for transport.
The file’s last-modified time in Unix milliseconds.
Returns nil after the files are attached.
First() Create a locator for the first matching element. Nth() Create a locator for a matching element at a zero-based index. Returns an error when the index is negative. The zero-based match index.