Clear() and SendKeys() in a single method
-
I have the methods
clear
andsendKeys
and wanted"colapsar"
the two in one,WebElement user = webdriver.findElement(By.id("username")); user.clear(); user.sendKeys(username); WebElement passw = webdriver.findElement(By.id("password")); passw.clear(); passw.sendKeys(password);
-
You can create a new method:
public void setNewInputValue(WebElement elem, String value) { elem.clear(); elem.sendKeys(value); }