I am using Puppeteer for web scraping and have a button element with various attributes. I managed to capture its text content using a query selector, but now I need a method to obtain the value from a specific data attribute. For example, consider the following HTML:
<button class="btn full-width btn-secondary" data-role-id="login-btn" type="submit">
<span class="label">Login</span>
</button>
I would like to know how to retrieve the value of the data attribute (in this case, the value of data-role-id) using Puppeteer. Any guidance on the correct approach would be appreciated.