0

Writing the following command in the console:

document.querySelectorAll("[type='checkbox']")

Returns:

NodeList(12) [input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719, input.jss719]

This is exactly what I want to achieve in Codeceptjs, so I can later loop through the elements.

I've tried creating custom functions like:

 allSelector: function (selector)  {
  return Array.from.document.querySelectorAll(selector)
}

However, I keep getting null when console logging:

  let checkboxes =  (await I.grabAttributeFrom("[type='checkbox']"))

  console.log(checkboxes)
boYan
  • 3
  • 1

1 Answers1

0

You need to specify the attribute name, for example 'name'

let checkboxes =  (await I.grabAttributeFrom("[type='checkbox']", "name"))
Egor
  • 1