如何使用JAVA和ADB命令检查Appium中的键盘是否打开 [英] How can I check If Keyboard is open or not in Appium using JAVA and ADB command

查看:306
本文介绍了如何使用JAVA和ADB命令检查Appium中的键盘是否打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试检查android默认键盘是否打开。我没有在Appium中找到使用JAVA和ADB命令检查键盘的任何东西。

I am trying to check, if android default keyboard is open or not. I did not find anything to check keyboard using JAVA and ADB command in Appium.

推荐答案

我发现此ADB命令可以检查键盘

I have found this ADB command to check keyboard is opened or not.

adb shell dumpsys input_method | grep mInputShown

在输出 mInputShown = true 中键盘已打开,如果键盘已关闭,则 mInputShown = false
JAVA代码:

In output mInputShown=true if keyboard is open and mInputShown=false if keyboard is closed. JAVA code:

String cmd[] = new String[]{"adb", "shell", "dumpsys", "input_method", "|" ,"grep", "mInputShown"};
Process process = Runtime.getRuntime().exec(cmd);    
BufferedReader reader = new BufferedReader(new InputStreamReader(        
process.getInputStream()));
String output = reader.readLine();

这篇关于如何使用JAVA和ADB命令检查Appium中的键盘是否打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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