Skip to content

@gtkx/testing / findByLabelText

Function: findByLabelText()

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

Defined in: queries.ts:404

Finds a single element that is labelled by a GtkLabel whose text matches.

Waits for the element to appear, throwing if not found within timeout. Uses GtkLabel's mnemonic widget association to find form elements.

Parameters

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

Returns

Promise<Widget>

Promise resolving to the labelled widget

Example

tsx
const input = await findByLabelText(container, "Username");