Class: DOMInteractor
Defined in: packages/dom-core/src/DOMInteractor.ts:32
Implements​
Interactor
Constructors​
Constructor​
new DOMInteractor(
rootEl):DOMInteractor
Defined in: packages/dom-core/src/DOMInteractor.ts:33
Parameters​
rootEl​
HTMLElement = document.documentElement
Returns​
DOMInteractor
Properties​
rootEl​
protectedreadonlyrootEl:HTMLElement=document.documentElement
Defined in: packages/dom-core/src/DOMInteractor.ts:33
Methods​
blur()​
blur(
locator,_option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:295
Remove focus from the element found by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<BlurOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved when blur has been applied
Throws​
If the element is not found
Implementation of​
Interactor.blur
calculateMousePosition()​
protectedcalculateMousePosition(el,preferredPoint?):Point
Defined in: packages/dom-core/src/DOMInteractor.ts:64
Parameters​
el​
Element
preferredPoint?​
Point
Returns​
Point
click()​
click(
locator,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:81
Dispatch a click event on the element that matches the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
ClickOption
Optional click configuration such as the click position
Returns​
Promise<void>
A promise that resolves after the event is triggered
Throws​
If the element is not found
Implementation of​
Interactor.click
clone()​
clone():
Interactor
Defined in: packages/dom-core/src/DOMInteractor.ts:503
Returns​
Interactor
Implementation of​
Interactor.clone
enterText()​
enterText(
locator,text,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:315
Type text into the element matched by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
text​
string
The string to type
option?​
Partial<EnterTextOption>
Options such as appending or replacing existing value
Returns​
Promise<void>
Promise resolved when typing has completed
Throws​
If the element is not found
Implementation of​
Interactor.enterText
exists()​
exists(
locator):Promise<boolean>
Defined in: packages/dom-core/src/DOMInteractor.ts:374
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Implementation of​
Interactor.exists
focus()​
focus(
locator,_option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:276
Move focus to the element found by the locator.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<FocusOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved when focus has been applied
Throws​
If the element is not found
Implementation of​
Interactor.focus
getAttribute()​
Call Signature​
getAttribute(
locator,name,isMultiple):Promise<readonlystring[]>
Defined in: packages/dom-core/src/DOMInteractor.ts:34
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:35
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:36
Parameters​
locator​
PartLocator
name​
string
Returns​
Promise<Optional<string>>
Implementation of​
Interactor.getAttribute
getElement()​
Call Signature​
getElement<
T>(locator,isMultiple):Promise<readonlyT[]>
Defined in: packages/dom-core/src/DOMInteractor.ts:379
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:380
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:381
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:393
Parameters​
locator​
PartLocator
Returns​
Promise<Optional<string>>
Implementation of​
Interactor.getInputValue
getSelectLabels()​
getSelectLabels(
locator):Promise<Optional<readonlystring[]>>
Defined in: packages/dom-core/src/DOMInteractor.ts:415
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<readonlystring[]>>
Defined in: packages/dom-core/src/DOMInteractor.ts:405
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:54
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:425
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:488
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:480
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:111
Move the mouse over the element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
HoverOption
Reserved for future use
Returns​
Promise<void>
A promise that resolves after the hover event
Throws​
If the element is not found
Implementation of​
Interactor.hover
innerHTML()​
innerHTML(
locator):Promise<string>
Defined in: packages/dom-core/src/DOMInteractor.ts:497
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:433
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Implementation of​
Interactor.isChecked
isDisabled()​
isDisabled(
locator):Promise<boolean>
Defined in: packages/dom-core/src/DOMInteractor.ts:441
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Implementation of​
Interactor.isDisabled
isReadonly()​
isReadonly(
locator):Promise<boolean>
Defined in: packages/dom-core/src/DOMInteractor.ts:452
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Implementation of​
Interactor.isReadonly
isVisible()​
isVisible(
locator):Promise<boolean>
Defined in: packages/dom-core/src/DOMInteractor.ts:456
Parameters​
locator​
PartLocator
Returns​
Promise<boolean>
Implementation of​
Interactor.isVisible
mouseDown()​
mouseDown(
locator,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:151
Dispatch a mousedown event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseDownOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
Promise resolved when the event is dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseDown
mouseEnter()​
mouseEnter(
locator,_option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:240
Dispatch a mouseenter event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseEnterOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved after the event dispatches
Throws​
If the element is not found
Implementation of​
Interactor.mouseEnter
mouseLeave()​
mouseLeave(
locator,_option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:259
Dispatch a mouseleave event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseLeaveOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseLeave
mouseMove()​
mouseMove(
locator,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:127
Dispatch a mousemove event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseMoveOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
A promise that resolves once the event has been dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseMove
mouseOut()​
mouseOut(
locator,_option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:223
Dispatch a mouseout event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
_option?​
Partial<MouseOutOption>
Reserved for future use
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseOut
mouseOver()​
mouseOver(
locator,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:199
Dispatch a mouseover event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<HoverOption>
Optional mouse position relative to the element
Returns​
Promise<void>
Promise resolved once the event is dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseOver
mouseUp()​
mouseUp(
locator,option?):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:175
Dispatch a mouseup event on the target element.
Parameters​
locator​
PartLocator
Locator used to find the target element
option?​
Partial<MouseUpOption>
Allows specifying the mouse position relative to the element
Returns​
Promise<void>
Promise resolved when the event is dispatched
Throws​
If the element is not found
Implementation of​
Interactor.mouseUp
selectOptionValue()​
selectOptionValue(
locator,values):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:349
Select one or more option values in a <select> element.
Parameters​
locator​
PartLocator
Locator used to find the select element
values​
string[]
Values of the options to select
Returns​
Promise<void>
Promise resolved when the options have been selected
Throws​
If the element is not found
Implementation of​
Interactor.selectOptionValue
wait()​
wait(
ms):Promise<void>
Defined in: packages/dom-core/src/DOMInteractor.ts:358
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:369
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:362
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