I\'ve got some tests where I\'m checking that the proper error message appears when text in certain fields are invalid. One check for validity is that a certain textarea el
You can use
webElement.clear();
If this element is a text entry element, this will clear the value.
Note that the events fired by this event may not be as you'd expect. In particular, we don't fire any keyboard or mouse events. If you want to ensure keyboard events are fired, consider using something like sendKeys(CharSequence). E.g.:
webElement.sendKeys(Keys.BACK_SPACE); //do repeatedly, e.g. in while loop
or:
webElement.sendKeys(Keys.CONTROL + "a");
webElement.sendKeys(Keys.DELETE);