Skip to content

@gtkx/testing / findByName

Function: findByName()

findByName(container, name, options?): Promise<Widget>

Defined in: queries.ts:483

Finds a single element by widget name.

Uses the widget's name property (gtk_widget_get_name). Set via the name prop on GTKX components.

Parameters

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

Returns

Promise<Widget>

Promise resolving to the matching widget

Example

tsx
// In component: &lt;GtkButton name="submit-btn" />
const button = await findByName(container, "submit-btn");