如何使用键盘操作Appium Android按绿色tick按钮
在我的代码中,我需要按一些数字,然后单击“绿色勾号”按钮。
单击后,预期是隐藏键盘,并显示错误验证消息。
我在脚本中具有以下代码。
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.DIGIT_2));
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.DIGIT_3));
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.DIGIT_4));
((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.ENTER));
根据代码。它进入值。不确定要通过哪个androidkey按下绿色tick按钮,我通过Androidkey.enter。它提供了不同的行为,并手动按Enter Enter提供相同的行为。
任何人都可以告诉他如何通过Androidkey参数,因此按下绿色tick键。 绝对不是进入。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我从以下解决方案的其他组中找到了。
driver.executescript(“移动:performeditorAction”,immutableMap.of(“ action”,“ go”));
支持的其他选项列表可以在以下站点中找到:
https://appium.io/文档/EN/写作 - 录取/android/android-ime/
也
当我们可见键盘时,单击后按钮也隐藏了键盘,并显示屏幕。
I found from other groups below solutions.
driver.executeScript(“mobile: performEditorAction”, ImmutableMap.of(“action”, “Go”));
List of other options supported can be found in below sites:
https://developer.android.com/reference/android/view/inputmethod/EditorInfo
https://appium.io/docs/en/writing-running-appium/android/android-ime/
Also,
When we have keypad visible, clicking on BACK button also hides the keyboard and it shows the screen.
请使用10位数字的有效手机号码,因为这似乎可以在移动应用程序上进行验证。
您的脚本还不错,除了输入有效的手机号码,使用您的自动化脚本。
另外,请首先检查任何有效的手机号码,然后使用您的自动化脚本输入相同的手机号码,这应该解决您的问题。
Please use valid mobile number of 10 digits as this seems to be get validated on mobile app.
Your script is fine except entering a valid mobile number with your automation script.
Also, please check first manually any valid mobile number and then input the same mobile number with your automation script, this should resolve your issue then.