A TestElement implementation for WebDriver.
API
class SeleniumWebDriverElement implements TestElement {
constructor(element: () => webdriver.WebElement, _stabilize: () => Promise<void>): SeleniumWebDriverElement;
blur(): Promise<void>;
clear(): Promise<void>;
click(modifiers?: any): Promise<void>;
click(location: "center", modifiers?: any): Promise<void>;
click(relativeX: number, relativeY: number, modifiers?: any): Promise<void>;
rightClick(relativeX: number, relativeY: number, modifiers?: any): Promise<void>;
focus(): Promise<void>;
getCssValue(property: string): Promise<string>;
hover(): Promise<void>;
mouseAway(): Promise<void>;
sendKeys(...keys: any[]): Promise<void>;
sendKeys(modifiers: ModifierKeys, ...keys: any[]): Promise<void>;
text(options?: any): Promise<string>;
setContenteditableValue(value: string): Promise<void>;
getAttribute(name: string): Promise<string | null>;
hasClass(name: string): Promise<boolean>;
getDimensions(): Promise<ElementDimensions>;
getProperty<T = any>(name: string): Promise<T>;
setInputValue(newValue: string): Promise<void>;
selectOptions(...optionIndexes: number[]): Promise<void>;
matchesSelector(selector: string): Promise<boolean>;
isFocused(): Promise<boolean>;
dispatchEvent(name: string, data?: Record<string, EventData> | undefined): Promise<void>;
}
constructor
SeleniumWebDriverElement() => webdriver.WebElement
() => Promise<void>
SeleniumWebDriverElement
blur
Promise<void>Blur the element.
Promise<void>
clear
Promise<void>Clear the element's input (for input and textarea elements only).
Promise<void>
click
3 overloadsClick the element at the default location for the current environment. If you need to guarantee the element is clicked at a specific location, consider using click('center') or click(x, y) instead.
any
Promise<void>
Click the element at the element's center.
"center"
any
Promise<void>
Click the element at the specified coordinates relative to the top-left of the element.
numberCoordinate within the element, along the X-axis at which to click.
numberCoordinate within the element, along the Y-axis at which to click.
anyModifier keys held while clicking
Promise<void>
rightClick
Promise<void>Right clicks on the element at the specified coordinates relative to the top-left of it.
numberCoordinate within the element, along the X-axis at which to click.
numberCoordinate within the element, along the Y-axis at which to click.
anyModifier keys held while clicking
Promise<void>
focus
Promise<void>Focus the element.
Promise<void>
getCssValue
Promise<string>Get the computed value of the given CSS property for the element.
string
Promise<string>
hover
Promise<void>Hovers the mouse over the element.
Promise<void>
mouseAway
Promise<void>Moves the mouse away from the element.
Promise<void>
sendKeys
2 overloadsSends the given string to the input as a series of key presses. Also fires input events and attempts to add the string to the Element's value.
any[]
Promise<void>
Sends the given string to the input as a series of key presses. Also fires input events and attempts to add the string to the Element's value.
ModifierKeys
any[]
Promise<void>
text
Promise<string>Gets the text from the element.
anyOptions that affect what text is included.
Promise<string>
setContenteditableValue
Promise<void>Sets the value of a contenteditable element.
stringValue to be set on the element.
Promise<void>
getAttribute
Promise<string | null>Gets the value for the given attribute from the element.
string
Promise<string | null>
hasClass
Promise<boolean>Checks whether the element has the given class.
string
Promise<boolean>
getDimensions
Promise<ElementDimensions>Gets the dimensions of the element.
Promise<ElementDimensions>
getProperty
Promise<T>Gets the value of a property of an element.
string
Promise<T>
setInputValue
Promise<void>Sets the value of a property of an input.
string
Promise<void>
selectOptions
Promise<void>Selects the options at the specified indexes inside of a native select element.
number[]
Promise<void>
matchesSelector
Promise<boolean>Checks whether this element matches the given selector.
string
Promise<boolean>
isFocused
Promise<boolean>Checks whether the element is focused.
Promise<boolean>
dispatchEvent
Promise<void>Dispatches an event with a particular name.
stringName of the event to be dispatched.
Record<string, EventData> | undefined
Promise<void>