您的位置:首页 > 移动开发

Appium和UIAutomator英文和数字输入问题记录

2014-09-23 18:49 204 查看
Appium对中文支持有问题已经是众所周之得了,但是今天用Appium编写一个创建Note的实例的时候发现Appium对含有英文和数字的字串输入也有问题。</span>

比如如果想用driver.sendkeys来输入“Note1",事实上你会得到的是Note。实践中发现如果英文字串和数字之间加多一个空格就能解决问题,比如输入”Note 1",最终得到的就会是"Note1".
实践发现UIAutomator存在同样的问题,因为Appium底层调用的就是UIAutomator,所以最终的Bug应该是是属于UIAutomator这一边的。
以下Appium代码可以验证这个问题:

//Enter the note info and save it         WebElement text = driver.findElementByClassName("android.widget.EditText");        <span style="color:#ff0000;"> text.sendKeys("Note 1");</span>                  driver.sendKeyEvent(82);         el = driver.findElement(By.name("Save"));         el.click();                  //Find out the new added note entry         List <WebElement> entries = driver.findElements(By.className("android.widget.TextView"));                  WebElement targetEntry = null;         for(WebElement entry : entries) {         	<span style="color:#ff0000;">if(entry.getText().equals("Note1")) </span>{         		targetEntry = entry;         		break;         	}         }


作者
自主博客 微信 CSDN
天地会珠海分舵 http://techgogogo.com
服务号:TechGoGoGo 扫描码:

天地会珠海分舵” 博客,请务必保留此出处http://techgogogo.blog.51cto.com/3851580/1608444
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐