Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created December 19, 2020 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliasnogueira/770dfa403b816cbd3a32f1fbd7422bd9 to your computer and use it in GitHub Desktop.
Save eliasnogueira/770dfa403b816cbd3a32f1fbd7422bd9 to your computer and use it in GitHub Desktop.
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