Skip to main content

Function: toCssSelector()

toCssSelector(locator, interactor): Promise<string>

Defined in: packages/core/src/utils/locatorUtil.ts:159

Reduce a PartLocator to the single CSS selector the interactor runs against the DOM. This is the one locator-resolution seam in the system, and it is CSS-only by design for 1.0 — every locator must express itself as CSS here (see ADR-008).

An AccessibleRoleLocator segment (findByRole) has no CSS representation at all — see splitAtAccessibleRoleLocator, which every interactor consults BEFORE reaching this function. Calling this directly with such a locator is a caller error, not a silent fallback.

Parameters​

locator​

PartLocator

interactor​

Interactor

Returns​

Promise<string>