how to confirm a NumberPicker after sending data with Appium

…衆ロ難τιáo~ 提交于 2019-12-24 16:22:13

问题


I write test automation for Android Native app. And I want to enter/send value to a NumberPicker, my code is below:

WebElement heightValue = appiumDriver.findElement(By.className("android.widget.NumberPicker"));
heightValue.sendKeys("180");
appiumDriver.findElement(By.id("com.kmp.connect.coach:id/buttonDefaultPositive")).click();

Problem is, I have to click confirm on native keyboard and then click OK button of my app, then value is set. But I can not interfere with native keyboard. I try InputMethodManager but I couldn't get context of the app. I want to somehow send "Done" to keyboard

I am using Appium with selenium


回答1:


This one interacts with native keyboard action key - enter(confirm):

driver.sendKeyEvent(66);


来源:https://stackoverflow.com/questions/35412630/how-to-confirm-a-numberpicker-after-sending-data-with-appium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!