Appium : Clear a field

后端 未结 26 3097
野趣味
野趣味 2020-12-16 16:03

I have my login screen in app now. Each time the app is launched in screen the mobile number is pre filled with the older text.

I just want to know I have tried:

26条回答
  •  [愿得一人]
    2020-12-16 16:53

    To avoid recent iOS 8.x errors I use the following (where by is an instance of By representing your textfield/textview):

        int stringLength = driver.findElement(by).getText().length();
        if (stringLength > 0) {
            driver.findElement(by).clear();
        }
    

    If you try and call clear() against an already clear textfield I was tending to get errors in appium.

提交回复
热议问题