.getNextElementSibling() Suggest edits
Since: 3.0.0Returns 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).
For more info on working with DOM elements in Nightwatch, refer to the Finding & interacting with DOM Elements guide page.
Usage
browser.element(selector).getNextElementSibling()
Example
export default {
demoTest(browser: NightwatchAPI): void {
browser.element('.features-container li:first-child').getNextElementSibling().then(resultElement => {
console.log('next sibling element Id:', resultElement.getId());
});
},
async demoTestAsync(browser: NightwatchAPI): Promise<void> {
const resultElement = await browser.element('.features-container li:first-child').getNextElementSibling();
console.log('next sibling element Id:', resultElement.getId());
}
}
Returns
Type | description |
---|---|
ScopedWebElement |