简体   繁体   English

如何用appium接口隐藏ios真机的键盘

[英]How to hide keyboard of ios real device with appium interface

I want to hide keyboard of my real device from appium interface.我想从 appium 界面隐藏我真实设备的键盘。 Is there any capability that i can use?有什么我可以使用的功能吗? I tried some solutions but it didn't work for me.我尝试了一些解决方案,但对我不起作用。 We are using hideKeyboard() on the code side but i dont know what we can use on interface of appium.我们在代码端使用 hideKeyboard() 但我不知道我们可以在 appium 的界面上使用什么。 Can you help me pls?你能帮我吗?

Here is the snippet:这是片段:

{
"platformName": "iOS", 
"platformVersion": "13.2.3", 
"deviceName": "iPhone 6s", 
"udid": "udid of ios phone", 
"bundleId": "bundleId of app", 
"automationName": "XCUITest", 
"noReset": true, 
"fullReset": false 
}

Try this code:试试这个代码:

public static IOSDriver<IOSElement> iosDriver;
iosDriver.hideKeyboard();

work for me on simulator and real iOS devices在模拟器和真正的 iOS 设备上为我工作

Or you can try this code:或者你可以试试这个代码:

public void hideKeyboard() {
    driver().switchTo().activeElement().sendKeys(Keys.RETURN);
}

This work when you have active form input element, and this function tap return in button in keyboard当你有活动的表单输入元素时,这个工作,这个 function 在键盘按钮中点击返回

self.driver.hide_keyboard()

You can visit here to know more about the library.您可以访问此处以了解有关图书馆的更多信息。 Hide the keyboard 隐藏键盘

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

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