如何与Appium发送数据后确认NumberPicker [英] how to confirm a NumberPicker after sending data with Appium

查看:422
本文介绍了如何与Appium发送数据后确认NumberPicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的Andr​​oid原生应用的自动化测试。我想输入/值发送到一个NumberPicker,我的code是如下:

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();

问题是,我必须先点击确认本机键盘上,然后单击我的应用程序的OK按钮,然后值被设定。但我不能与本地键盘干扰。
我尝试InputMethodManager,但我不能让应用程序上下文。我想以某种方式发送完成键盘

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

我使用Appium硒

推荐答案

这一次与本地键盘操作键相互作用 - 输入(确认):

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

driver.sendKeyEvent(66);

这篇关于如何与Appium发送数据后确认NumberPicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆