Categories
accessibility functional-testing javascript nightwatch.js selenium

Nightwatch js how to assert multiple elements

i’m trying to assert/verify multiple elements for an attribute with Nightwatch.js.

I tried to use the “elements” command by selenium but it seems to not actually return a tag.

browser.elements('css selector','icon_checkmark', function (result) {
this.verify.attributeEquals(result.value, 'aria-hidden', 'true');
})

The console outputs this error:

Testing if attribute aria-hidden of <[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]> equals "true". 
Element could not be located. - expected "true" but got: null
ERROR: Unable to locate element: "[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]" using: css selector

It seems like it finds the right things because there should be 6 but then somehow I read out the wrong thing? Console.log of result.value[0] gives just { ELEMENT: ’19’ } which seems correct.

Any idea how could I make this work? I want to check if all elements with the class icon_checkmark have an attribute aria-hidden=”true”.