File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 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 ('点击第一篇文章' )
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments