Automation Using Selenium Webdriver

Wednesday 19 October 2016

how to delete default values in text field using selenium

Selenium WebDriver:  overwrite value in field instead of appending to it with sendKeys using Java

Use this Code:

element.sendKeys(Keys.chord(Keys.CONTROL, "a"), "55");


how to delete default values in text field using selenium:
Use this Code

WebElement toClear = driver.findElement("locator");
toClear.sendKeys(Keys.CONTROL + "a");
toClear.sendKeys(Keys.DELETE);

Selenium: delete contents from a textbox


The keyPress event of selenium can be helpful:

selenium.sendKeys("text1", "ABCD");
selenium.sendKeys("text1", "\b");
selenium.sendKeys("text1", "\b");

This will Click Backspace key twice

No comments:

Post a Comment