简体   繁体   中英

appium .clear() doesnt work on EditText java

When I'm executing .clear() method on Appium on an EditText instead of clearing it the cursor goes on the beginning of the EditText and it shows a suggestion to replace the first word. Here is the java code that I'm using:

List<WebElement> clearName = driver.findElements(By.className("android.widget.EditText"));        
    clearName.get(0).clear();

Same thing happens when i try to clear the text by name:

driver.findElement(By.name("My Name")).clear();

Any ideas? Thanks!

In latest version of Appium, we just need to call sendKey() that internally clears the field value and updates with value that you have passed.

Can you please try this?

driver.findElement(By.name("My Name")).sendKey("some text");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM