Skip to main content

Class: DOMInteractor

Defined in: packages/dom-core/src/DOMInteractor.ts:30

Implements

  • Interactor

Constructors

Constructor

new DOMInteractor(rootEl): DOMInteractor

Defined in: packages/dom-core/src/DOMInteractor.ts:31

Parameters

rootEl

HTMLElement = document.documentElement

Returns

DOMInteractor

Properties

rootEl

protected readonly rootEl: HTMLElement = document.documentElement

Defined in: packages/dom-core/src/DOMInteractor.ts:31

Methods

calculateMousePosition()

protected calculateMousePosition(el, preferredPoint?): Point

Defined in: packages/dom-core/src/DOMInteractor.ts:59

Parameters

el

Element

preferredPoint?

Point

Returns

Point


click()

click(locator, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:68

Click on the desired element

Parameters

locator

PartLocator

option?

ClickOption

Returns

Promise<void>

Implementation of

Interactor.click


clone()

clone(): Interactor

Defined in: packages/dom-core/src/DOMInteractor.ts:372

Returns

Interactor

Implementation of

Interactor.clone


enterText()

enterText(locator, text, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:198

Type text into the desired element

Parameters

locator

PartLocator

text

string

option?

Partial<EnterTextOption>

Returns

Promise<void>

Implementation of

Interactor.enterText


exists()

exists(locator): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:246

Parameters

locator

PartLocator

Returns

Promise<boolean>

Implementation of

Interactor.exists


focus()

focus(locator, _option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:190

Parameters

locator

PartLocator

_option?

Partial<FocusOption>

Returns

Promise<void>

Implementation of

Interactor.focus


getAttribute()

Call Signature

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

Defined in: packages/dom-core/src/DOMInteractor.ts:32

Parameters
locator

PartLocator

name

string

isMultiple

true

Returns

Promise<readonly string[]>

Implementation of

Interactor.getAttribute

Call Signature

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

Defined in: packages/dom-core/src/DOMInteractor.ts:33

Parameters
locator

PartLocator

name

string

isMultiple

false

Returns

Promise<Optional<string>>

Implementation of

Interactor.getAttribute

Call Signature

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

Defined in: packages/dom-core/src/DOMInteractor.ts:34

Parameters
locator

PartLocator

name

string

Returns

Promise<Optional<string>>

Implementation of

Interactor.getAttribute


getElement()

Call Signature

getElement<T>(locator, isMultiple): Promise<readonly T[]>

Defined in: packages/dom-core/src/DOMInteractor.ts:251

Type Parameters
T

T extends Element = Element

Parameters
locator

PartLocator

isMultiple

true

Returns

Promise<readonly T[]>

Call Signature

getElement<T>(locator, isMultiple): Promise<Optional<T>>

Defined in: packages/dom-core/src/DOMInteractor.ts:252

Type Parameters
T

T extends Element = Element

Parameters
locator

PartLocator

isMultiple

false

Returns

Promise<Optional<T>>

Call Signature

getElement<T>(locator): Promise<Optional<T>>

Defined in: packages/dom-core/src/DOMInteractor.ts:253

Type Parameters
T

T extends Element = Element

Parameters
locator

PartLocator

Returns

Promise<Optional<T>>


getInputValue()

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

Defined in: packages/dom-core/src/DOMInteractor.ts:265

Parameters

locator

PartLocator

Returns

Promise<Optional<string>>

Implementation of

Interactor.getInputValue


getSelectLabels()

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

Defined in: packages/dom-core/src/DOMInteractor.ts:286

Get the select element's selected options' labels

Parameters

locator

PartLocator

Returns

Promise<Optional<readonly string[]>>

Implementation of

Interactor.getSelectLabels


getSelectValues()

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

Defined in: packages/dom-core/src/DOMInteractor.ts:276

Get the select element's selected options' values

Parameters

locator

PartLocator

Returns

Promise<Optional<readonly string[]>>

Implementation of

Interactor.getSelectValues


getStyleValue()

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

Defined in: packages/dom-core/src/DOMInteractor.ts:51

Get the value of a style property

Parameters

locator

PartLocator

propertyName

CssProperty

Returns

Promise<Optional<string>>

Implementation of

Interactor.getStyleValue


getText()

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

Defined in: packages/dom-core/src/DOMInteractor.ts:296

Parameters

locator

PartLocator

Returns

Promise<Optional<string>>

Implementation of

Interactor.getText


hasAttribute()

hasAttribute(locator, name): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:357

Parameters

locator

PartLocator

name

string

Returns

Promise<boolean>

Implementation of

Interactor.hasAttribute


hasCssClass()

hasCssClass(locator, className): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:349

Parameters

locator

PartLocator

className

string

Returns

Promise<boolean>

Implementation of

Interactor.hasCssClass


hover()

hover(locator, _option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:90

Perform a mouse hover on the desired element

Parameters

locator

PartLocator

_option?

HoverOption

Returns

Promise<void>

Implementation of

Interactor.hover


innerHTML()

innerHTML(locator): Promise<string>

Defined in: packages/dom-core/src/DOMInteractor.ts:366

Get the HTML of an element

Parameters

locator

PartLocator

Returns

Promise<string>

Implementation of

Interactor.innerHTML


isChecked()

isChecked(locator): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:303

Parameters

locator

PartLocator

Returns

Promise<boolean>

Implementation of

Interactor.isChecked


isDisabled()

isDisabled(locator): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:311

Parameters

locator

PartLocator

Returns

Promise<boolean>

Implementation of

Interactor.isDisabled


isReadonly()

isReadonly(locator): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:321

Parameters

locator

PartLocator

Returns

Promise<boolean>

Implementation of

Interactor.isReadonly


isVisible()

isVisible(locator): Promise<boolean>

Defined in: packages/dom-core/src/DOMInteractor.ts:325

Parameters

locator

PartLocator

Returns

Promise<boolean>

Implementation of

Interactor.isVisible


mouseDown()

mouseDown(locator, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:113

Parameters

locator

PartLocator

option?

Partial<MouseDownOption>

Returns

Promise<void>

Implementation of

Interactor.mouseDown


mouseEnter()

mouseEnter(locator, _option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:170

Parameters

locator

PartLocator

_option?

Partial<MouseEnterOption>

Returns

Promise<void>

Implementation of

Interactor.mouseEnter


mouseLeave()

mouseLeave(locator, _option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:181

Parameters

locator

PartLocator

_option?

Partial<MouseLeaveOption>

Returns

Promise<void>

Implementation of

Interactor.mouseLeave


mouseMove()

mouseMove(locator, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:97

Mouse move on the desired element

Parameters

locator

PartLocator

option?

Partial<MouseMoveOption>

Returns

Promise<void>

Implementation of

Interactor.mouseMove


mouseOut()

mouseOut(locator, _option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:161

Parameters

locator

PartLocator

_option?

Partial<MouseOutOption>

Returns

Promise<void>

Implementation of

Interactor.mouseOut


mouseOver()

mouseOver(locator, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:145

Parameters

locator

PartLocator

option?

Partial<HoverOption>

Returns

Promise<void>

Implementation of

Interactor.mouseOver


mouseUp()

mouseUp(locator, option?): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:129

Parameters

locator

PartLocator

option?

Partial<MouseUpOption>

Returns

Promise<void>

Implementation of

Interactor.mouseUp


selectOptionValue()

selectOptionValue(locator, values): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:222

Select option by value from a select element

Parameters

locator

PartLocator

values

string[]

Returns

Promise<void>

Implementation of

Interactor.selectOptionValue


wait()

wait(ms): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:230

Wait for a given amount of time in milliseconds

Parameters

ms

number

Returns

Promise<void>

Implementation of

Interactor.wait


waitUntil()

waitUntil<T>(option): Promise<T>

Defined in: packages/dom-core/src/DOMInteractor.ts:241

Keep running a probe function until it returns a value that matches the terminate condition or timeout

Type Parameters

T

T

Parameters

option

WaitUntilOption<T>

Returns

Promise<T>

The last value returned by the probe function

Implementation of

Interactor.waitUntil


waitUntilComponentState()

waitUntilComponentState(locator, option): Promise<void>

Defined in: packages/dom-core/src/DOMInteractor.ts:234

Wait until the component is in the expected state such as the component's visibility or existence. If the component has not reached the expected state within the timeout, it will throw an error.

By default it waits until the component is attached to the DOM within 30 seconds.

Parameters

locator

PartLocator

The locator of the component to wait for

option

Partial<Readonly<WaitForOption>> = defaultWaitForOption

The option to configure the wait behavior

Returns

Promise<void>

Implementation of

Interactor.waitUntilComponentState