.elementIdElements() Suggest edits
Search for multiple elements on the page, starting from the identified element. The located element will be returned as a web element JSON objects.
Please note that this command operates on a protocol level and accepts the Web Element ID as the parameter.
To retrieve it, use either the .element()
or .elements()
command. Read more on Element retrieval.
Usage
.elementIdElements(webElementId, using, value, callback)
Parameters
Name | Type | description |
---|---|---|
webElementId |
string | The Web Element ID of the element to route the command to. |
using |
string | The locator strategy to use. |
value |
string | The search target. |
callback |
function | Callback function which is called with the result value. |
Example
module.exports = {
'demo Test' : function(browser) {
browser.elementIdElements('', 'css selector', 'ul li', function(result) {
console.log(result.value)
});
},
'es6 async demo Test': async function(browser) {
const result = await browser.elementIdElements('', 'css selector', 'ul li');
console.log(result.value);
},
'page object demo Test': function (browser) {
var nightwatch = browser.page.nightwatch();
nightwatch.navigate();
const navbarHeader = nightwatch.section.navbarHeader;
navbarHeader.api.elementIdElements('@versionDropdown', 'css selector', 'option', function(result) {
browser.assert.equal(result.value.length, 2, 'There are two option elements in the drop down');
});
}
}