Skip to content
CodeKruPro

Double-click a button

Automation taskEasy-MediumAsked in: Accenture, Capgemini, Infosys, TCS, Wipro

"How do you double-click in Selenium?" The element's own click method cannot do it, but the actions API can. Check that the page reacted, for example by reading the new button text.

Double Click Action

Double Click Action

actions.doubleClick(element) simulates a double click.

On the Buttons page, the double-click button (id="doubleClick") changes text to "I was double-clicked!" when double-clicked.

Task:

  1. Navigate to https://testkru.com/Elements/Buttons
  2. Find the doubleClick button and print its initial text
  3. Double-click it using the Actions class
  4. Print its text after double-clicking

Expected output:

Before: Double click on me
After: I was double-clicked!