Double click operations in Selenium WebDriver

Today we are going to discuss another mouse events handling in Selenium, which is performing double click operations in Selenium WebDriver.  Again we will use the Actions class to handle scenarios which require performing the double click on any web elements. In the previous article, we discussed performing right click operations and we further elaborated by considering the scenario of SAP Hybris Management Console (HMC) application. Hope you are now comfortable with the previous topics and all the topics related to Actions class as well.

It’s time to jump one step further in learning Selenium WebDriver. The procedure would be the same like previous mouse events which we have discussed, but here we will call a different method from Actions class, which is only specified to perform double click operations on web elements available on the Automation test application.


It is important to give some wait to the application to load it properly and perfect synchronization so that WebDriver could avoid exceptions. It will be good if you handle exceptions properly.

Technical Specifications of Double click operations in Selenium

  • We need to import interactions package to create Actions class instance
  • Package: org.openqa.selenium.interactions.Actions
  • Then, we need to call the method doubleClick()

double click operations

Syntax of Double click operation in WebDriver

Here is the default syntax for double click operations:


Let me explain you the above syntax.

First, we create the instance of Actions class and we pass driver as an argument in the instance. Further, we call the doubleClick() method which is available inside the Actions class. Here we pass web element as an argument in the doubleClick() method. This is the element where double click operations have to perform by the WebDriver.

Special Case:

Above command will help you clicking on specific web element, but, if you want to click on the location where your mouse pointer is currently in. Then in this case, you just remove the argument from the doubleClick() method and proceed as above. So the method would be like:

  • doubleClick()

Hence, the syntax will look like;


Hope the concept of double click operations is clear to you all now.

Test Steps as functional awareness of double click operations

Before I give you sample double click program for your reference, I’d like you to read the test steps first; because it will help you to develop functional awareness of the scenario. It is good to have function knowledge for an automation tester.

Here are the test steps:

Step# 1: Open the test application

Step# 2: Scroll to the element where double click button is available

Step# 3: Perform double click operations on the button

Step# 4: Validate the actual and expected result to determine failure criteria

If you have any confusion regarding this chapter, feel free to post your queries in the comment below or you can directly contact me through social media or the contact form of this site.

Here is the sample program on double click operations in Selenium WebDriver:

Learn: How to create dynamic CSS Selector?


Leave a Reply