How to get attribute value of an element with JS - TestCafe?

How can I get the attribute value of an element with TestCafe?

Hi Emma,

To get the value of the attribute, you use the getAttribute() method as follows:

const link = document.querySelector('a');
let method = link.getAttribute('data-method');