huayuan1002 发表于 2019-1-7 14:27:13

fautotest框架打开设备


FAutoTest是腾讯自家开发来做微信H5页面的自动测试框架,既然企鹅能将其开源,说明这个框架应该是经过其内部验证实践的。我们可以从GitHub上找到这个开源项目地址
https://github.com/Tencent/FAutoTest/

感觉现成案例还比较少。

就先把自己学习的、实践的发在这里。
希望以后越来越多。

huayuan1002 发表于 2019-1-7 14:29:29

代码:
由于框架是给予fastAutoTest的,所以要按照他们的指引安装python和相关包,然后:

# encoding:utf-8
from fastAutoTest.core.h5.h5Engine import H5Driver
from fastAutoTest.utils.adbHelper import AdbHelper
from uiautomator import device as d
import os

#获得设备列表
myAdb =AdbHelper()
myDeviceList = myAdb.listDevices()

if len(myDeviceList) == 0 :
    print "Error: we don't find any device."
    exit(-1)
else :
    print "Info: we find device(s) ..."
    print myDeviceList

#获得我的设备名称,目前只使用一个
myDevice = myDeviceList

#通过adb命令启动手机微信
os.system('adb -s %s shell am start com.tencent.mm/com.tencent.mm.ui.LauncherUI' %myDevice )
##launchWebView   
#d(text='中国电信客服').click()
#d(text='查询').click()
#d(text='套餐余量').click()
##关闭手机微信
os.system('adb -s %s shell am start com.tencent.mm/com.tencent.mm.ui.LauncherUI' %myDevice )

赵佳乐SMILE 发表于 2019-1-9 06:23:24

棒棒哒

赵佳乐SMILE 发表于 2019-1-9 06:46:02

不好意思 本来要加分 结果弄错了
页: [1]
查看完整版本: fautotest框架打开设备