There are many times that we have some fields that were prefilled and we have to pass some value in the field. So, we first have to clear the textbox and then click the pass the desired text in the field.
Suppose we have to check the login functionality in a website, so as soon as we will enter the login screen is opened it is prefilled with the credentials of previous user. Appium provides a clear() method to clear any field.
//Launch the application.
driver.findElement(By.id("user_name")).click();
driver.findElement(By.id("user_name")).clear();
//Now send new username
driver.findElement(By.id("user_name")).sendKeys("new user_name");
So, first we have clicked on username fields then cleared the field and entered the new username.
1 Comment(s)