可以将一些通用的操作写在一个 .air 脚本里,然后在其他脚本中 import 它。Airtest提供了 using 接口,能够将需要引用的脚本加入 sys.path 里,其中包含的图片文件也会被加入 Template 的搜索路径中。
from airtest.core.api import using
using("common.air")
from common import common_function
common_function()
========================================================================
一般airtest脚本默认都执行了from airtest.core.api import *,所以import using这一步一般不用加
使用using加载需要导入的air
执行导入
========================================================================
Airtest官方参考文档https://airtest.readthedocs.io/zh_CN/latest/README_MORE.html#import-from-other-air
网友评论