I have an array of multiple elements and I need to check the inner text of each ones. It won't be a problem if I had only one element, because I would call element.getText() method on it. But I don't know what to do with an array of elements.
Here is my code :
await browser.elements('css selector', '.myCSSClass', async function (elements) {
console.log(elements.value)
elements.value.forEach(function (element) {
browser.elementIdText(element.ELEMENT, function (result) {
console.log(result)
console.log(result.value)
})
})
})
Here is the result:
Error First argument passed to .elementIdText() should be a web element ID string. Received undefined. See https://nightwatchjs.org/api/elementIdText.html
First console.log gives me the following array:
[ { 'element-6066-11e4-a52e-4f735466cecf': '6A348CF895A32F15D11F5E5DE43F0B2D_element_78' }, { 'element-6066-11e4-a52e-4f735466cecf': '6A348CF895A32F15D11F5E5DE43F0B2D_element_79' } ]
What am I missing here ?
I tried using element.getText() and browser.elementIdText(). Same result.