Skip to content

@serenity-is/corelib / tryGetWidget

Function: tryGetWidget()

tryGetWidget<TWidget>(element, type?): TWidget

Defined in: src/ui/widgets/widgetutils.ts:64

Tries to find a widget associated with an element, optionally filtering by type.

Type Parameters

TWidget

TWidget

Parameters

element

The element (or selector/array-like) to search.

string | Element | ArrayLike<HTMLElement>

type?

(...args) => TWidget

Optional widget type to filter by; when omitted, the first associated widget is returned.

Returns

TWidget

The matching widget, or null if none is found.