美文网首页
Airtest引用其他的 .air 脚本

Airtest引用其他的 .air 脚本

作者: 果冻_50fc | 来源:发表于2020-07-25 22:57 被阅读0次

可以将一些通用的操作写在一个 .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

相关文章

网友评论

      本文标题:Airtest引用其他的 .air 脚本

      本文链接:https://www.haomeiwen.com/subject/iqkvlktx.html