I try to double click on the text box by which the text will be selected.....The code looks like
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com/");
WebElement txtBoxElement=driver.findElement(By.xpath("//*[@id='email']"));
txtBoxElement.sendKeys("abc");
System.out.println("Test start");
Actions builder=new Actions(driver);
Action a=builder.moveToElement(txtBoxElement).doubleClick(txtBoxElement).build();
a.perform();
//This is for another way to double click on the text field
Locatable locatable = (Locatable) driver.findElement(By.name("email"));
Mouse mouse = ((HasInputDevices) driver).getMouse();
mouse.mouseMove(locatable.getCoordinates());
mouse.doubleClick(locatable.getCoordinates());
System.out.println("Test Complete");
}
but both of this way was not working I bypass this problem using this
Action a=builder.moveToElement(txtBoxElement).sendKeys(txtBoxElement,Keys.chord(Keys.CONTROL,"a")).build();
a.perform();
my question is why double click is not working? I also try this for google search textbox it was also not working. Here I want to mention one thing that I use Selenium 2.37 and firefox 26 .
I did not get any error but not double click on this element.I also observe that if I commented out the txtBoxElement.sendKeys("abc"); part and then sendkeys using Actions event,it write the text on browser address bar.