Created
December 19, 2020 17:19
-
-
Save eliasnogueira/a81dda30c46b8531424180338df4b5bd to your computer and use it in GitHub Desktop.
Clean input fields inside a form running a Javascript function using Selenium WebDriver + Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pre and post conditions ignored | |
@Test | |
void cleanByJSExecutor() { | |
((JavascriptExecutor) driver).executeScript("document.getElementById('my-form').reset()"); | |
driver.findElement(By.id("email")).sendKeys("new@email.com"); | |
driver.findElement(By.id("password")).sendKeys("987654321"); | |
driver.findElement(By.id("address")).sendKeys("Viebrug"); | |
driver.findElement(By.id("address2")).sendKeys("1"); | |
driver.findElement(By.id("city")).sendKeys("Utrecht"); | |
driver.findElement(By.id("zipcode")).sendKeys("3511 AJ"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment