Skip to content
CodeKruPro

Click a button and read its new text

Automation taskEasy

The simplest interaction task: "Click this button and check that its label changes." Read the text before and after the click, so the test proves the click did something.

Click a Button

Click a Button

The click() method simulates a left mouse click on an element.

On the Buttons page, the button with ID leftClick has text "Left click on me". When clicked, its text changes to "I was left-clicked!".

Task:

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

Expected output:

Before: Left click on me
After: I was left-clicked!
Read full tutorial on Codekru