java - Appium - 无法访问 hideKeyboard() 方法

标签 java appium appium-android

我看到 AndroidDriver 层次结构如下。

AndroidDriver -> AppiumDriver -> DefaultGenericMobileDriver -> MobileDriver -> HidesKeyboard

使用appium java-client 7.2.0版本。

HidesKeyboard 接口(interface)已实现 hideKeyboard() 方法。当我尝试使用 AndroidDriver 对象时,该方法不可用。

enter image description here

我希望下面的代码能够工作。有什么线索吗?

AndroidDriver<AndroidElement> androidDriver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
androidDriver.hideKeyboard();

根据官方文档,hideKeyboard() 方法应该是可访问的。

http://appium.io/docs/en/commands/device/keys/hide-keyboard/

enter image description here

最佳答案

如果您想在整个测试过程中隐藏键盘,请使用以下命令:

caps.setCapability("unicodeKeyboard", true);
caps.setCapability("resetKeyboard", true);

关于java - Appium - 无法访问 hideKeyboard() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58187428/

相关文章:

java - 获取错误 : Please make sure to specify the 'deviceName' capability in Appium v1. 0.0

java - 无法将按键发送到输入元素

java - Hibernate 中复合主键部分的不同标准

java - Eclipse Gradle 插件 : <some pom file> cannot be read or is not a valid ZIP file

selenium - 是否可以使用 appium 和 nightwatchjs 为移动 native 应用程序编写测试?

java - 出现错误 : cannot access org. openqa.selenium.virtualauthenticator.HasVirtualAuthenticator

java - 使用 Jackson 将瞬间序列化为毫秒?

java - 如何使用改造设置路径参数

android - 通过使用 Appium 匹配关键字滚动并单击 TextView

appium - WebdriverIO 不使用 config.path 访问 Appium Server