.getFirstElementChild() Suggest edits
Since: 2.0.0Returns an element's first child. The child 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.getFirstElementChild(selector, [callback])
browser.getFirstElementChild(selector)
browser.element(selector).getFirstElementChild()
Example
module.exports = {
'demo Test': function(browser) {
const resultElement = await browser.getFirstElementChild('.features-container');
console.log('last child element Id:', resultElement.getId());
},
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. |