Skip to content
CodeKruPro

Click Elements

14/70

Click Elements

Playwright's locator.click() clicks an element. Playwright automatically waits for the element to be visible and enabled before clicking.

On the Buttons page, the "Left click on me" button (id: leftClick) changes its text after being clicked.

Task:

  1. Navigate to https://testkru.com/Elements/Buttons
  2. Find the button with ID leftClick
  3. Print the button text before clicking
  4. Click the button
  5. Print the button text after clicking

Expected output:

Before: Left click on me
After: I was left-clicked!