简体   繁体   English

如何使用Appium for IOS隐藏键盘而不关闭对话框?

[英]How to hide keyboard without closing the dialog box using Appium for IOS?

I have a dialog box that appears and while closing keyboard with hideKeyboard(); 我有一个对话框出现,同时使用hideKeyboard();关闭键盘时hideKeyboard(); all the form is closed and i get back to the home page so that i can't continue the scenario for filling other data. 所有的表格都关闭了,我回到首页,这样我就无法继续填写其他数据的场景。

Here the screen : 这里的屏幕:

在此处输入图片说明

Just use UIScrollView in your dialog box, and set scroll view class TPKAScrollViewController. 只需在对话框中使用UIScrollView,然后设置滚动视图类TPKAScrollViewController。 Download class 下载类

You can fill up the fields first using driver.sendkey() then tap on keyboard next button to switch the driver to the next field untill the last field. 您可以先使用driver.sendkey()填写字段,然后点击键盘的next按钮将驱动程序切换到下一个字段,直到最后一个字段。 in last field you will get done button then you can tap on that button. 在最后一个字段中,您将完成按钮,然后可以点击该按钮。

The default "strategy" of hideKeyboard(); hideKeyboard();的默认“策略” hideKeyboard(); is to tap outside the keyboard, but this can be changed to pressing a key on the keyboard instead. 是在键盘外部点击,但这可以更改为改为按下键盘上的某个键。

See the java-client documentation (assuming you're using java-client?) for available hideKeyboard strategies: http://appium.github.io/java-client/io/appium/java_client/ios/IOSDeviceActionShortcuts.html 有关可用的hideKeyboard策略,请参阅Java客户端文档(假设您正在使用Java客户端?): http ://appium.github.io/java-client/io/appium/java_client/ios/IOSDeviceActionShortcuts.html

If your app's keyboard has for example a "Next" button to close the keyboard with, then you could use: driver.hideKeyboard("Next"); 例如,如果您的应用程序的键盘具有“下一步”按钮来关闭键盘,则可以使用: driver.hideKeyboard("Next");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM