How can I click on a button that has "data-cy" attribute in puppeteer?

Viewed 151

There is a div with data-cy="169-small-control-button".

How could I click on it just like you can click on id:

await page.click('#169-small-control-button');

Edit: found the answer:

await page.click('div[data-cy="169-small-control-button"]');
0 Answers
Related