Skip to main content

Function: queryByTestId()

queryByTestId(container, testId, options?): Widget | null

Defined in: queries.ts:245

Finds a single element matching a test ID without throwing.

Parameters

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

Returns

Widget | null

The matching widget or null if not found

Throws

Error if multiple elements match