Here, we discuss that how to double click on a button in Selenium WebDriver. In this, Actions Class helps to double click on any element or button.
 
Also, we need to import:
 
'import org.openqa.selenium.interactions.Actions'
 
 
Steps to be automated:
	- Launch the browser
- Open your site
- Find the element on which you have to double click
- Double click on that element
 
WebDriver Code goes as below: 
 
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
public class DoubleClick {
	public static void main(String[] args) {
		
        WebDriver driver = new FirefoxDriver();
		
        driver.get("http://only-testing-blog.blogspot.in/2014/09/selectable.html");
        
        
		driver.manage().timeouts().implicitlyWait(20L, TimeUnit.SECONDS);
		driver.manage().window().maximize();
		
		
		WebElement dblclk = driver.findElement(By.xpath(".//*[@id='post-body-7297556448793668582']/div[1]/button"));
		
		Actions action1 = new Actions(driver).doubleClick(dblclk);
		action1.build().perform();
		
	}
}
 
                       
                    
0 Comment(s)