Appium和UIAutomator英文和数字输入问题记录
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
扫描码:
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。