Reputation: 75
How can I use Playwright to click on the button in the image, identified by its class name? It's important to note that the button's name changes daily, starting with 'Collect 10 Candies' and incrementing by *2 each day, before resetting every week.
Upvotes: 0
Views: 4746
Reputation: 75
This is the solution that worked for me:
page.query_selector("button[data-action='click->points#claimCandy'][data-target='points.button']").click()
Upvotes: 0
Reputation: 982
Your locator for that class can be this:
.collect-candy-button
so:
page.locator(`.collect-candy-button`).click()
Upvotes: 2