O'Reilly logo

Selenium Testing Tools Cookbook by Unmesh Gundecha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing double-click on an element

There will be elements in a web application that need double-click events fired for performing some actions. For example, double-clicking on a row of a table will launch a new window. The Advanced User Interaction API provides a method to perform double-click.

In this recipe, we will use the Actions class to perform double-click operations.

How to do it...

Let's create a test that locates an element for which a double-click event is implemented. When we double-click on this element, it changes its color.

@Test public void testDoubleClick() throws Exception { WebDriver driver = new ChromeDriver(); driver.get("http://dl.dropbox.com/u/55228056/DoubleClickDemo.html"); WebElement message = driver.findElement(By.id("message")); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required