【拉勾5期】app 企业微信实战(一)

标题

app 企业微信实战(一)

课程价值

  • 了解 Appium 框架结构
  • 掌握 Appium 环境搭建
  • 掌握 Appium Inspector 录制及查找元素的使用
  • 掌握 元素定位技巧

大纲

  • Appium 介绍
  • Appium 环境搭建
  • Appium Inspector
  • 元素定位技巧
  • 企业微信实战-打卡

时长

90分钟

PPT

appium框架结构

连接adb

【win版】
adb connect 127.0.0.1:7555
adb shell

【mac版】

adb kill-server && adb server && adb shell

获取app的包名、activity

mac:

adb logcat "ActivityManager:I *:s" | grep "cmp"
win:

adb logcat ActivityManager:I *:s | findstr "cmp"

常用定位

//*[contains(@resource-id, ‘login’)](重点)
//*[@text=‘登录’]  (重点)
//*[contains(@resource-id, ‘login’) and contains(@text, ‘登录’)] (重点)

脚本编写

应用

参考链接

appium 环境搭建:Appium 环境搭建( windows 版本 | Mac版本)
sdk 环境 参照:Android Studio安装(推荐使用这种方法安装SDK)

参考代码

    def test_daka(self):
        self.driver.find_element(MobileBy.XPATH,"//*[@text='工作台']").click()
        self.driver.find_element(MobileBy.ANDROID_UIAUTOMATOR,
                                 'new UiScrollable(new UiSelector().'
                                 'scrollable(true).instance(0)).'
                                 'scrollIntoView(new UiSelector().'
                                 'text("打卡").instance(0));').click()
        self.driver.find_element(MobileBy.XPATH,"//*[@text='外出打卡']").click()
        self.driver.find_element(MobileBy.XPATH,"//*[contains(@text,'次外出')]").click()
        r = self.driver.find_element(MobileBy.ID,"com.tencent.wework:id/mn").text
        assert r == "外出打卡成功"

代码地址

https://github.com/ceshiren/HogwartsLG5.git

作业

编写企业微信添加联系人自动化脚本

课后反馈调查表

https://github.com/zhangmj111/HogwartsLG5
test_appium_homework1

github:https://github.com/shengang19941226/HogwartsLG5
PO模式:


image

https://github.com/liujianxiao27/Homework
[appiumClassOneHomework]包
image
po模式 封装底层公共方法 封装工具类 步骤数据封装在yaml

https://github.com/year210818/HogwartsLG5.git

https://github.com/vmsenwh/LG05_6-1/tree/master/test_appium

appium企业微信添加联系人作业:
https://github.com/chenlei-123/HogwartsLG5

appium企业微信添加联系人

https://github.com/lili2778738/lg5lili/commit/673c7283f9e902c57ae92d07f6e86071ac19ebe0

appium的第一次作业:企业微信app添加成员
https://github.com/judy728/HogwartsLG5

https://github.com/fujinjie/HogwartsLG5_code.git

APP添加联系人作业
https://github.com/Allison001/homework/tree/master/app_wechat

https://github.com/AllenGuo0858/HogwartsLG5/tree/main/appium_work1

https://github.com/yangguolong828/LG5Zuoye/tree/main/test_appium/test_appium1

APP.py文件
https://github.com/LongTengYu/Caculator/tree/master/WeChatWork

https://github.com/nuannanxiaofeige/HogwartsLG5/tree/master/python_work/appium_work1

https://github.com/the9sjeric/appnium_HW01

https://github.com/shulianpang/homeworkPro/tree/master/appium_test1

https://github.com/crazyBoyGo/lagou05

https://github.com/fanchenlong/HogwartsPytest