Element
import {Element} from 'cabbie-sync';
A representation of a remote element. You can use it to click on, type text into and check the attributes of.
const element = driver.activeWindow.getElement('[data-test-id="my-test-element"]');
const elements = driver.activeWindow.getElements('.some-class-name');
Properties
elementID: string
The selenium id of the element
mouse: Mouse
Utility methods for clicking on the element
touch: Touch
Methods for interacting with the element via touch
Methods
clear(): void
Clear the value of an input
getAbsoluteCenter(): {x:number, y:number}
Get the absolute center of an element
getAttribute(attribute): string
- attribute
- string
Get the value of an attribute.
getCssValue(property): string
- property
- string
Query the value of an element's computed CSS property. The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).
getElement(selector, selectorType?): Element
- selector
- string
- selectorType
- SelectorType
Get an element via a selector. Will throw an error if the element does not exist.
getElementByTextContent(textContent, selector?, selectorType?): Element
- textContent
- string
- selector
- string
- selectorType
- SelectorType
Get elements by its text content, optionally narrowed down using a selector.
N.B. this is much slower than getting elements by ID or css selector.
getElements(selector, selectorType?): Array<Element>
- selector
- string
- selectorType
- SelectorType
Get elements via a selector.
getElementsByTextContent(textContent, selector?, selectorType?): Array<Element>
- textContent
- string
- selector
- string
- selectorType
- SelectorType
Get elements by its text content, optionally narrowed down using a selector.
N.B. this is much slower than getting elements by ID or css selector.
getFrame(): {x:number, y:number, width:number, height:number}
Get the frame of an element
getPosition(): {x:number, y:number}
Get the position of an element
getRelativeCenter(): {x:number, y:number}
Get the relative center of an element
getSize(): {width:number, height:number}
Get the size of an element
getTagName(): string
Get the tag-name of an element.
getText(): string
Get the text body of an element.
hasClass(className): boolean
- className
- string
Test if the element have a specific class
hasElement(selector, selectorType?): boolean
- selector
- string
- selectorType
- SelectorType
Does a specific element exist?
isDisabled(): boolean
Return true if the form element is disabled
isDisplayed(): boolean
Return true if the element is currently displayed on the page
isEnabled(): boolean
Return true if the form element is enabled
isEqual(element): boolean
- element
- Element
Return true if the current element is equal to the supplied element
isSelected(): boolean
Return true if the form element is selected
sendKeys(str): void
- str
- string | Array<string>
todo: uploading files ala wd.Element.sendKeys
Type a string of characters into an input
submit(): void
Submit a form element