I ran into a problem while switching from firefoxdriver to chromedriver with selenium, it was working fine in FF but now when I try to clear a date input field I have this e
I have a solution to this that I have just used in my ChromeDriver project in Eclipse. It is also a work around.
I found that simply using {webElement.Keys} only deleted part of the text in the input field. So you must first use the left arrow key to select the entire text to delete.
The following code should work in ChromeDriver. It is in Java (using Eclipse):
private WebDriver driver;
driver= new ChromeDriver();
Actions action = new Actions(driver);
int lenText = driver.findElement(By.xpath(elementLocator)).getText().length();
for(int i = 0; i < lenText; i++){
action.sendKeys(Keys.ARROW_LEFT);
}
action.build().perform();
for(int i = 0; i < lenText; i++){
action.sendKeys(Keys.DELETE);
}
Thread.sleep(1000);
action.build().perform();