如何使用 JAVA 和 ADB 命令在 Appium 中检查键盘是否打开

编程入门 行业动态 更新时间:2024-10-28 14:32:08
本文介绍了如何使用 JAVA 和 ADB 命令在 Appium 中检查键盘是否打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在尝试检查 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-17 19:05:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/919178.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   键盘   命令   ADB   JAVA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!