Skip to main content

Interface: ElementQueries

Defined in: packages/core/src/interactor/Interactor.ts:337

Read-only element queries: values, attributes, geometry, presence/count, and boolean state (checked/disabled/visible/…), plus the innerHTML debug read. A capability facet of Interactor (ADR-007); none of these mutate the DOM.

Extended by​

Methods​

exists()​

exists(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:375

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


getAttribute()​

Call Signature​

getAttribute(locator, name, isMultiple): Promise<readonly string[]>

Defined in: packages/core/src/interactor/Interactor.ts:350

Parameters​
locator​

PartLocator

name​

string

isMultiple​

true

Returns​

Promise<readonly string[]>

Call Signature​

getAttribute(locator, name, isMultiple): Promise<Optional<string>>

Defined in: packages/core/src/interactor/Interactor.ts:351

Parameters​
locator​

PartLocator

name​

string

isMultiple​

false

Returns​

Promise<Optional<string>>

Call Signature​

getAttribute(locator, name): Promise<Optional<string>>

Defined in: packages/core/src/interactor/Interactor.ts:352

Parameters​
locator​

PartLocator

name​

string

Returns​

Promise<Optional<string>>


getBoundingRect()​

getBoundingRect(locator): Promise<BoundingRect>

Defined in: packages/core/src/interactor/Interactor.ts:373

Get the element's bounding rectangle in CSS pixels.

jsdom has no layout engine, so every coordinate and dimension is 0 there: the returned rect is structurally valid but behaviorally meaningless. Assertions about real geometry are therefore E2E-only; under jsdom this returns a zero-rect.

Parameters​

locator​

PartLocator

Locator of the element to measure

Returns​

Promise<BoundingRect>


getElementCount()​

getElementCount(locator): Promise<number>

Defined in: packages/core/src/interactor/Interactor.ts:392

Count every element matching the locator.

Where exists is a presence check that stops at the first match, this resolves the locator to its full match set and returns the cardinality — the multi-match counterpart the list helpers use to size a collection in one round-trip instead of probing index by index. A locator matching nothing yields 0.

Homogeneous-match semantics: the count is by locator match, not by tag position. A sibling that shares an item's tag but does not satisfy the locator is not counted — the opposite of :nth-of-type, which counts by tag among all siblings. This is what lets the count side of a list stay correct when the items are interleaved with a same-tag non-item (a header/divider).

Parameters​

locator​

PartLocator

Returns​

Promise<number>


getInputValue()​

getInputValue(locator): Promise<Optional<string>>

Defined in: packages/core/src/interactor/Interactor.ts:338

Parameters​

locator​

PartLocator

Returns​

Promise<Optional<string>>


getSelectLabels()​

getSelectLabels(locator): Promise<Optional<readonly string[]>>

Defined in: packages/core/src/interactor/Interactor.ts:348

Get the select element's selected options' labels

Parameters​

locator​

PartLocator

Returns​

Promise<Optional<readonly string[]>>


getSelectValues()​

getSelectValues(locator): Promise<Optional<readonly string[]>>

Defined in: packages/core/src/interactor/Interactor.ts:343

Get the select element's selected options' values

Parameters​

locator​

PartLocator

Returns​

Promise<Optional<readonly string[]>>


getStyleValue()​

getStyleValue(locator, propertyName): Promise<Optional<string>>

Defined in: packages/core/src/interactor/Interactor.ts:359

Get the value of a style property

Parameters​

locator​

PartLocator

propertyName​

CssProperty

Returns​

Promise<Optional<string>>


getText()​

getText(locator): Promise<Optional<string>>

Defined in: packages/core/src/interactor/Interactor.ts:361

Parameters​

locator​

PartLocator

Returns​

Promise<Optional<string>>


hasAttribute()​

hasAttribute(locator, name): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:410

Parameters​

locator​

PartLocator

name​

string

Returns​

Promise<boolean>


hasCssClass()​

hasCssClass(locator, className): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:409

Parameters​

locator​

PartLocator

className​

string

Returns​

Promise<boolean>


innerHTML()​

innerHTML(locator): Promise<string>

Defined in: packages/core/src/interactor/Interactor.ts:416

Get the HTML of an element

Parameters​

locator​

PartLocator

Returns​

Promise<string>


isChecked()​

isChecked(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:393

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


isDisabled()​

isDisabled(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:394

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


isError()​

isError(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:406

Whether the element is in an invalid/error state, signalled by aria-invalid="true" (the cross-widget convention; native validity state is not consulted).

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


isReadonly()​

isReadonly(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:395

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


isRequired()​

isRequired(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:400

Whether the element is marked required, via the native required property or an aria-required="true" attribute.

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>


isVisible()​

isVisible(locator): Promise<boolean>

Defined in: packages/core/src/interactor/Interactor.ts:407

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>