| 12345678910111213141516171819202122232425262728293031323334353637 |
- from airtest.core.api import init_device,assert_exists,Template,touch
- from time import sleep
- DD_BUNDLE_ID = 'com.laiwang.DingTalk' # 钉钉包名
- WDA_BUNDLE_ID = 'com.caner.test.xctrunner' #个人包名
- UDID = '00008030-000415D614E0402E' # pymobiledevice3 usbmux list 查看手机id
- def offDuty():
- # 下班工作台
- touch(Template('./img/gzt_black.png'))
- sleep(1)
- # 点击考勤
- touch(Template('./img/checking_black.png'))
-
- def onDuty():
- # 上班工作台
- touch(Template('./img/gzt_white.png'))
- def main():
- try:
- # 连接手机->自动启动wda
- wda = init_device("IOS",UDID)
- try:
- # 打开d钉钉
- wda.start_app(DD_BUNDLE_ID)
- sleep(1)
- offDuty()
- wda.snapshot('test4.png')
- except Exception as es:
- print('操作错误',es)
- except EnvironmentError as e:
- print('连接错误',e)
- if __name__ == '__main__':
- main()
|