如何使用 Java 在 appium 中关闭键盘? [英] How to dismiss the keyboard in appium using Java?

查看:21
本文介绍了如何使用 Java 在 appium 中关闭键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这段代码只是为了找到文本框并向它发送一些文本.当它这样做时,键盘出现在 android 设备上.如何在 sendKeys 后关闭它.

This code just aims to find the textbox and send some text to it. When it does that the keyboard appears on the android device.How to dismiss it after the sendKeys.

@Test
    public static void test_demo() throws Exception {
        WebElement element = driver.findElement(By.id("mytextfield"));
        element.sendKeys("test");
        //how do I dismiss keyboard which appears on my android device after sendKeys?  
    }

推荐答案

driver.hideKeyboard() 仅适用于 AppiumDriver.我正在使用包含此功能的 java-client-2.2.0.jar.

driver.hideKeyboard() will only work with AppiumDriver. I am using java-client-2.2.0.jar that contains this capability.

这篇关于如何使用 Java 在 appium 中关闭键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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