Appium:清除字段 [英] Appium : Clear a field

查看:23
本文介绍了Appium:清除字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在在应用程序中有我的登录屏幕.每次在屏幕上启动应用程序时,手机号码都会预先填充旧文本.

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:

WebElement mob = driver.findElement(By.name("Mobile Number"));
mob.clear // Not working

我试过了:

String Mobile
mob="";   

但它仍然无法删除预先填充的文本.

but still it cannot delete the pre filled text.

我正在尝试使用 appium 自动化我的 android 应用程序,请帮助我.

I am trying to automate my android app using appium, please help me with this.

推荐答案

在清除之前单击 textBox 应该可以使用最新的库:

A click on to the textBox before you clear should do with the latest libs:

WebElement mob = driver.findElement(By.name("Mobile Number"));
mob.click();
mob.clear();

或来自示例 jUnitTest 这里

OR from the sample jUnitTest here

WebElement text = driver.findElement(By.xpath("//UIATextField[1]"));
text.sendKeys("12");
text.clear();

我猜

这篇关于Appium:清除字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆