Robot Framework Get Library Instance

在Robot Framework中,可以通过get_library_instance方法在模型文件中获取库(类)实例。示例1导入库名qa.RWWindowsTestAppliance,示例2导入路径${RootTarget}/libs/python/lib/qa/AtaWrapper.py,库名为AtaWrapper。在关键字中,可以使用BuiltIn().get_library_instance('RWQAAPCLIKeywords')获取实例,并调用其方法如get_version、set_beacon_interval等。返回的库实例可以传递给其他库关键字和资源关键字使用。
摘要由CSDN通过智能技术生成

Get Library Instance
In model file, we can get library(class) instance via get_library_instance.

lib name is the lib name when you import in test file.
Example 1:
Setting Value
Library qa.RWWindowsTestAppliance
Library name is qa.RWWindowsTestAppliance.
Example 2:
Setting Value
Library ${RootTarget}/libs/python/lib/qa/AtaWrapper.py
Library name is AtaWrapper.

from robot.libraries.BuiltIn import BuiltIn
def station_disconnect_from_wlan():
apcli = BuiltIn().get_library_instance(‘RWQAAPCLIKeywords’)
version = apcli.get_version()
apcli.set_beacon_interval(“wlan3”, 500)
apcli.get_beacon_interval(“wlan3”)
device_name = apcli.get_device_name()
model_name = apcli.get_model_name()
return model_name

The object return from Get Library Instance can be passed to library keywords and resource keywords.
In the following example, lib.get

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值