How .elements() works in nightwatch?
Asked 07 September, 2021
Viewed 2.3K times
  • 57
Votes

Considering I have multiple trs I want to pick one and edit value in it by clicking edit button bounded to it.

I'm doing something like this:

browser.elements('css selector', '#someId  tr', elements => {
  elements.value.forEach(val => {
    console.log(val)
  }

And I get something like this:

{
  'abcd-1234-qwer-0987': 'some id'
},
{
  'abcd-1234-qwer-0987': 'some other id'
}
  1. What is exactly 'abcd-1234-qwer-0987', is this session id kind of stuff and does it change?
  2. What is the best way to grab particular element? Because as I guess my approach is wrong: elements.value[1]['abcd-1234-qwer-0987']

2 Answer