/** * * Returns the previous sibling element of the selected DOM-element. * * :index.html

Sibling One

Sibling Two

Sibling Three

:previousElement.js it('should get text from previous sibling element', async () => { const elem = await $$('p'); const previousElem = await elem[1].previousElement() console.log(await previousElem.getText()); // outputs: "Sibling One" }); *
* * @alias element.previousElement * @return {WebdriverIO.Element} * @type utility */ export function previousElement (this: WebdriverIO.Element) { return this.$(/* istanbul ignore next */ function previousElement (this: HTMLElement) { return this.previousElementSibling as HTMLElement }) }