Skip to main content

Function: findByLabelText()

findByLabelText(container, text, options?): Promise<Widget>

Defined in: queries.ts:397

Finds a single element by its label or text content.

Matches button labels, input placeholders, window titles, and other accessible text content.

Parameters

ParameterTypeDescription
containerContainerThe container to search within
textTextMatchText to match (string, RegExp, or custom matcher)
options?TextMatchOptionsQuery options including normalization and timeout

Returns

Promise<Widget>

Promise resolving to the matching widget

Example

const button = await findByLabelText(container, "Click me");
const input = await findByLabelText(container, /search/i);