Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to clear field in Appium ?

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 2.89k
    Comment on it

    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)

  • i am using the same concept on Android:
              
     Appium_Mobile_Page.Msisdn.click();
     Appium_Mobile_Page.Msisdn.clear();
    Appium_Mobile_Page.Msisdn.sendKeys("9560038686");

    what it does it clears the value than when i send keys it shows me previous value + New value.Kindly suggest.
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: