Robot Framework Get Library Instance

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.getversion()canwork.And {lib.get version} can’t work.

Get firmware version AP1
libGetLibraryInstanceap1 {fw_version} Set Variable lib.getversion()BuiltIn.Log {fw_version}

發佈了52 篇原創文章 · 獲贊 2 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章