Skip to content

Commit c9ee414

Browse files
committed
add code
1 parent 783c066 commit c9ee414

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

doudou/2020-10-20-appium/app.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from appium import webdriver
2+
3+
desired_capabilities = {
4+
"platformName": "Android", # 操作系统
5+
"deviceName": "emulator-5554", # 设备 ID
6+
"platformVersion": "6.0.1", # 设备版本号
7+
"appPackage": "com.tencent.mm", # app 包名
8+
"appActivity": "com.tencent.mm.ui.LauncherUI", # app 启动时主 Activity
9+
'noReset': True # 是否保留 session 信息 可以避免重新登录
10+
}
11+
12+
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities)
13+
print('链接到安卓模拟器')
14+
time.sleep(5)
15+
16+
driver.find_element_by_id('com.tencent.mm:id/f8y').click()
17+
print('查找搜索按钮')
18+
time.sleep(3)
19+
20+
driver.find_element_by_id('com.tencent.mm:id/bhn').send_keys('Python 技术')
21+
print('查找搜索输入框 & 写入搜索关键字')
22+
time.sleep(3)
23+
24+
driver.find_element_by_id('com.tencent.mm:id/tm').click()
25+
print('点击 icon 图标')
26+
time.sleep(3)
27+
28+
driver.find_element_by_id('com.tencent.mm:id/cj').click()
29+
print('点击右上角头像')
30+
time.sleep(3)
31+
32+
driver.find_element_by_id('com.tencent.mm:id/a1u').click()
33+
print('点击第一篇文章')

doudou/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Python技术 公众号文章代码库
1414
+ [python-skills](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-06-19-skills):Python 骚操作
1515
+ [lagou](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-07-13-lagou):拉钩招聘数据分析
1616
+ [national-day](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-10-13-national-day):国庆旅游热图
17+
+ [Appium](https://github.com/JustDoPython/python-examples/tree/master/doudou/2020-10-20-appium):Appium 神器
1718

1819
---
1920

0 commit comments

Comments
 (0)