Returns the element immediately following the specified one in their parent's childNodes. The element will be returned as web element JSON object (with an added .getId() convenience method).

Usage

browser.getNextSibling(selector, callback)
browser.getNextSibling(selector)

Parameters

Name Type description
using
Optional
string

The locator strategy to use. See W3C Webdriver - locator strategies

selector string|object

The selector (CSS/Xpath) used to locate the element. Can either be a string or an object which specifies element properties.

callback function

Callback function which is called with the result value.

Example

module.exports = {
 'demo Test': function(browser) {
    const resultElement = await browser.getNextSibling('.features-container li:first-child');

    console.log('next sibling element Id:', resultElement.getId());
  },

Recommended content