how to confirm a NumberPicker after sending data w

2019-08-15 20:56发布

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条回答
欢心
2楼-- · 2019-08-15 21:09

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

driver.sendKeyEvent(66);
查看更多
登录 后发表回答