selenium - 如何通过自动化脚本查找已安装的应用程序版本?
问题描述
我需要查找安装在移动设备中的应用程序版本,如果版本不是最新版本,则安装最新版本。在这里我如何自动查找已安装的应用程序版本?我正在使用 appium 和 selenium 来自动化我的脚本。
解决方案
如果您想查找 android 应用程序版本,您可以使用 shell 命令来完成
String cmd = "adb shell dumpsys package your.app.package.name.here |grep versionName";
Process process = null;
try {
process = Runtime.getRuntime().exec(cmd);
String appVersion = new BufferedReader(new InputStreamReader(process.getInputStream())).readLine();
System.out.println("appVersion = "+appVersion);
} catch (IOException e) {
e.printStackTrace();
}
有关更多信息,请查看此stackoverflow 问题
推荐阅读
- java - Apache Beam - RabbitMq 读取 - 失败确认消息和引发异常
- javascript - Vue 3:即使发出了也发出警告
- python - 使用循环读取文件并搜索内容,允许用户多次输入以找到匹配项
- vue.js - vue 应用程序最佳实践/模式以人性化标签显示数据?
- python - Python pandas:动态更改未指定列数的值
- java - 使用 Facebook 插页式广告时 if-else 无法正常工作,插页式广告会自动显示
- python - Python Pandas:将数据帧从一个导入库传递到另一个
- dynamics-crm-365 - oAuth2.0 使用 crm365 进行身份验证
- javascript - 更改字母的颜色不起作用
- angular - 离子如何将滚动添加到卡片