如何在Appium Android中处理datepicker [英] How to deal with datepicker in Appium Android
问题描述
我的Android应用程序正在使用datepicker,但是我无法通过datepicker选择日期。我在日期戳的应用程序中使用了以下代码,但不起作用。
My android application is using datepicker but i am not able to select date through datepicker. I used following code in application for datepicker but it does not work.
List<WebElement> pick = driver.findElements(By.className("android.widget.EditText"));
pick.get(0).sendKeys("21");
pick.get(1).sendKeys("Mar");
pick.get(2).sendKeys("1989");
推荐答案
我已经使用Xpath来执行Datepicker操作它正在正常工作。
I have used Xpath to perform Datepicker action & it is working properly.
driver.findElement(By.xpath(// android.widget.NumberPicker [@ index ='0']))。sendKeys Jan);
driver.findElement(By.xpath(// android.widget.NumberPicker [@ index ='1']))。sendKeys(24);
driver.findElement(By.xpath(// android.widget.NumberPicker [@ index ='2']))。sendKeys(1987);
driver.findElement(By.xpath("//android.widget.NumberPicker[@index='0']")).sendKeys("Jan"); driver.findElement(By.xpath("//android.widget.NumberPicker[@index='1']")).sendKeys("24"); driver.findElement(By.xpath("//android.widget.NumberPicker[@index='2']")).sendKeys("1987");
这篇关于如何在Appium Android中处理datepicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!