@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
| Parameter | Type | Description |
|---|---|---|
container | Container | The container to search within |
name | TextMatch | Widget name to match (string, RegExp, or custom matcher) |
options? | TextMatchOptions | Query options including normalization and timeout |
Returns
Promise<Widget>
Promise resolving to the matching widget
Example
tsx
// In component: <GtkButton name="submit-btn" />
const button = await findByName(container, "submit-btn");