惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Blog — PlanetScale
Blog — PlanetScale
The GitHub Blog
The GitHub Blog
Microsoft Security Blog
Microsoft Security Blog
I
InfoQ
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
L
LangChain Blog
F
Fortinet All Blogs
C
Check Point Blog
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
J
Java Code Geeks
月光博客
月光博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
小众软件
小众软件
宝玉的分享
宝玉的分享
Jina AI
Jina AI

高金的博客

人机协作逆向:用 AI + Frida 打通微信 4.1.8 macOS 数据库密钥提取 情绪价值与求真:如何平衡与应对? friend_tech 第一笔交易只能买 1 个key? friend_tech 套利到底有多卷 无公网ip,无服务器实现内网穿透 植物挖矿 浏览器环境检测 加密、编码相关知识汇总 使用tensorflow识别验证码 POW与反爬虫 知乎直播弹幕抓取与解析 知乎直播套利分析 1000刀+的羊毛在等你 如何创建一个完全匿名的EOS、ETH账号 如何通过技术手段证明"我"没有去过武汉 XUNTA 季度报告 玩游戏不如CX,JUSTGAME邀请分析(内附元数据) 如何在conflux上部署合约 程序员找对象聚合平台-xunta.today EOS 1.8 bidname的漏洞分析
appium 安卓无法点击搜索框解决办法
Gao JIn · 2020-04-19 · via 高金的博客

最近在弄python控制app做一些自动化的事情

碰到很多地方需要点击搜索按钮,搜了一堆,最终找到了完美的解决办法

之前的

1
2
3
4
5
6
7
8
9
10
def enter(self):
# 参考 http://www.lemfix.com/topics/277
# 切换成搜狗输入法
os.system("adb shell ime set com.sohu.inputmethod.sogou/.SogouIME")
sleep(5)
self.driver.press_keycode(66) # 按回车
sleep(3)
os.system("adb shell ime set io.appium.settings/.UnicodeIME")
sleep(3)
print("回车输入完毕.")

但是有时候也不好用。。。完全寄托于搜狗输入法

后面找到一种官方给出的解决办法

官方文档:https://appium.readthedocs.io/en/latest/en/writing-running-appium/android/android-ime/

基本上一劳永逸了,不过记得在 点击搜索按钮之前,记得先聚焦在 输入框。

1
2
3
4
#先聚焦在输入框
driver.find_element_by_id("com.tencent.mm:id/m7").click()
#点击搜索按钮
driver.execute_script('mobile: performEditorAction', {'action': 'search'})


本文作者:高金
本文地址https://igaojin.me/2020/04/19/appium-安卓无法点击搜索框解决办法/
版权声明:转载请注明出处!

推荐文章