Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clean input fields using Selenium WebDriver + Java
// pre and post conditions ignored
@Test
void cleanUsingSelenium() {
WebElement email = driver.findElement(By.id("email"));
email.clear();
email.sendKeys("new@email.com");
WebElement password = driver.findElement(By.id("password"));
password.clear();
password.sendKeys("987654321");
WebElement address = driver.findElement(By.id("address"));
address.clear();
address.sendKeys("Viebrug");
WebElement address2 = driver.findElement(By.id("address2"));
address2.clear();
address2.sendKeys("1");
WebElement city = driver.findElement(By.id("city"));
city.clear();
city.sendKeys("Utrecht");
WebElement zipCode = driver.findElement(By.id("zipcode"));
zipCode.clear();
zipCode.sendKeys("3511 AJ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment