Skip to main content

Class: PlaywrightInteractor

Defined in: PlaywrightInteractor.ts:31

Implementation of the Interactor interface using Playwright.

Implements​

  • Interactor

Constructors​

Constructor​

new PlaywrightInteractor(page): PlaywrightInteractor

Defined in: PlaywrightInteractor.ts:35

Parameters​

page​

Page

Playwright page instance used to drive the browser.

Returns​

PlaywrightInteractor

Properties​

page​

readonly page: Page

Defined in: PlaywrightInteractor.ts:35

Playwright page instance used to drive the browser.

Methods​

blur()​

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

Defined in: PlaywrightInteractor.ts:183

Remove focus from the desired element

Parameters​

locator​

PartLocator

_option?​

Partial<BlurOption>

Returns​

Promise<void>

Implementation of​

Interactor.blur


click()​

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

Defined in: PlaywrightInteractor.ts:123

Click on the desired element

Parameters​

locator​

PartLocator

option?​

Partial<ClickOption>

Returns​

Promise<void>

Implementation of​

Interactor.click


clone()​

clone(): Interactor

Defined in: PlaywrightInteractor.ts:321

Returns​

Interactor

Implementation of​

Interactor.clone


enterText()​

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

Defined in: PlaywrightInteractor.ts:104

Type text into the desired element

Parameters​

locator​

PartLocator

text​

string

option?​

Optional<Partial<EnterTextOption>>

Returns​

Promise<void>

Implementation of​

Interactor.enterText


exists()​

exists(locator): Promise<boolean>

Defined in: PlaywrightInteractor.ts:236

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>

Implementation of​

Interactor.exists


focus()​

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

Defined in: PlaywrightInteractor.ts:178

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: PlaywrightInteractor.ts:205

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: PlaywrightInteractor.ts:206

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: PlaywrightInteractor.ts:207

Parameters​
locator​

PartLocator

name​

string

Returns​

Promise<Optional<string>>

Implementation of​

Interactor.getAttribute


getInputValue()​

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

Defined in: PlaywrightInteractor.ts:54

Get the value of an <input> element.

Parameters​

locator​

PartLocator

Locator pointing to the input element.

Returns​

Promise<Optional<string>>

The current value of the input or undefined if not present.

Implementation of​

Interactor.getInputValue


getSelectLabels()​

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

Defined in: PlaywrightInteractor.ts:80

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: PlaywrightInteractor.ts:65

Retrieve the values of selected options within a <select> element.

Parameters​

locator​

PartLocator

Locator to the <select> element.

Returns​

Promise<Optional<readonly string[]>>

Array of selected option values or undefined when no option is selected.

Implementation of​

Interactor.getSelectValues


getStyleValue()​

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

Defined in: PlaywrightInteractor.ts:95

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: PlaywrightInteractor.ts:230

Parameters​

locator​

PartLocator

Returns​

Promise<Optional<string>>

Implementation of​

Interactor.getText


hasAttribute()​

hasAttribute(locator, name): Promise<boolean>

Defined in: PlaywrightInteractor.ts:309

Parameters​

locator​

PartLocator

name​

string

Returns​

Promise<boolean>

Implementation of​

Interactor.hasAttribute


hasCssClass()​

hasCssClass(locator, className): Promise<boolean>

Defined in: PlaywrightInteractor.ts:299

Parameters​

locator​

PartLocator

className​

string

Returns​

Promise<boolean>

Implementation of​

Interactor.hasCssClass


hover()​

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

Defined in: PlaywrightInteractor.ts:128

Perform a mouse hover on the desired element

Parameters​

locator​

PartLocator

option?​

Partial<HoverOption>

Returns​

Promise<void>

Implementation of​

Interactor.hover


innerHTML()​

innerHTML(locator): Promise<string>

Defined in: PlaywrightInteractor.ts:315

Get the HTML of an element

Parameters​

locator​

PartLocator

Returns​

Promise<string>

Implementation of​

Interactor.innerHTML


isChecked()​

isChecked(locator): Promise<boolean>

Defined in: PlaywrightInteractor.ts:242

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>

Implementation of​

Interactor.isChecked


isDisabled()​

isDisabled(locator): Promise<boolean>

Defined in: PlaywrightInteractor.ts:248

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>

Implementation of​

Interactor.isDisabled


isReadonly()​

isReadonly(locator): Promise<boolean>

Defined in: PlaywrightInteractor.ts:254

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>

Implementation of​

Interactor.isReadonly


isVisible()​

isVisible(locator): Promise<boolean>

Defined in: PlaywrightInteractor.ts:259

Parameters​

locator​

PartLocator

Returns​

Promise<boolean>

Implementation of​

Interactor.isVisible


mouseDown()​

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

Defined in: PlaywrightInteractor.ts:140

Parameters​

locator​

PartLocator

option?​

Partial<MouseDownOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseDown


mouseEnter()​

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

Defined in: PlaywrightInteractor.ts:166

Parameters​

locator​

PartLocator

_option?​

Partial<MouseEnterOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseEnter


mouseLeave()​

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

Defined in: PlaywrightInteractor.ts:170

Parameters​

locator​

PartLocator

_option?​

Partial<MouseLeaveOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseLeave


mouseMove()​

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

Defined in: PlaywrightInteractor.ts:133

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: PlaywrightInteractor.ts:158

Parameters​

locator​

PartLocator

_option?​

Partial<MouseOutOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseOut


mouseOver()​

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

Defined in: PlaywrightInteractor.ts:154

Parameters​

locator​

PartLocator

option?​

Partial<HoverOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseOver


mouseUp()​

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

Defined in: PlaywrightInteractor.ts:147

Parameters​

locator​

PartLocator

option?​

Partial<MouseUpOption>

Returns​

Promise<void>

Implementation of​

Interactor.mouseUp


selectOptionValue()​

selectOptionValue(locator, values): Promise<void>

Defined in: PlaywrightInteractor.ts:43

Select the given option values on a <select> element.

Parameters​

locator​

PartLocator

Locator to the <select> element.

values​

string[]

Values to select.

Returns​

Promise<void>

Implementation of​

Interactor.selectOptionValue


wait()​

wait(ms): Promise<void>

Defined in: PlaywrightInteractor.ts:189

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: PlaywrightInteractor.ts:200

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: PlaywrightInteractor.ts:193

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