The double click on WebElement action

Now that we have seen a method that double-clicks at the current location, we will discuss another method that WebDriver provides to emulate the double-clicking of a WebElement.

The API syntax for the doubleClick() method is as follows:

public Actions doubleClick(WebElement onElement)

The input parameter for the preceding method is the target WebElement that has to be double-clicked, and the return type is the Actions class.

Let's see a code example for this. Open the DoubleClick.html file and single-click on the Click Me button. You shouldn't see anything happening. Now double-click on the button; you should see an alert saying Double Clicked !!. Now we will try to do the same thing using WebDriver. ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.