appium :输入框控件为android.view.View 时输入内容(如:验证码、密码输入框)

问题背景

输入密码的组件信息为:<android.view.View resource-id="com.qq.ac.android:id/pwd_input">

由于输入框控件是android.view.View,不是android.widget.EditText,所以只能点击,而启动appium后,会将输入法切换至appium IME,导致输入发课件,也不能通过send_keys()、set_value()发送内容

解决方法

使用self.driver.press_keycode(7),输入内容为:0

复制代码
# 如:输入4个0
for pwd in range(4):
    self.driver.press_keycode(7)	  # 输入:0
    time.sleep(0.5)

参考文档:https://developer.android.com/reference/android/view/KeyEvent#KEYCODE_0

相关推荐
酿情师1 小时前
逆向exe文件:CRT 初始化流程详细分析
android·软件构建·逆向·re·crt‘
问心无愧05132 小时前
ctf show web入门71
android·前端·笔记
夜勤月3 小时前
AQS 与 ThreadPoolExecutor 深度拆解:JDK 高并发底层设计精髓
android·java·开发语言
Yeyu3 小时前
Android 卡顿诊断 SDK:从痛点出发的设计思考
android
上天_去_做颗惺星 EVE_BLUE4 小时前
Ubuntu Android 虚拟机安装使用教程
android·linux·测试工具·ubuntu·安卓
我命由我123454 小时前
Android 开发问题:Could not find com.github.PicnicSupermarket:FingerPaintView:1.2.
android·github·android studio·安卓·android jetpack·android-studio·android runtime
黄林晴5 小时前
Google Play 全面进化:AI 驱动增长,从上架到收入全链路重构
android·google
qq3621967056 小时前
Android 12/13/14/15 Google Play 兼容性检查指南:设备不兼容怎么办?2026最新解决方案
android·gitee
韩曙亮6 小时前
【错误记录】flutter attach 附加设备 执行报错 ( 附加设备注意事项 )
android·javascript·flutter·flutter attach