我正在尝试扩展RobotFramework SeleniumLibrary:
class ReusableModule(SeleniumLibrary):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
def __init__(self, timeout=0.5, implicit_wait=15.0, **kwargs):
logger.info("Reusable __init__")
SeleniumLibrary.__init__(self, timeout=timeout, implicit_wait=implicit_wait, **kwargs)
@keyword
def open_browser(self, url, browser=env.capabilities.get("browserName"), alias=None, remote_url=env.host,
desired_capabilities=env.capabilities, ff_profile_dir=None):
logger.info("Reusable open browser")
return super(ReusableModule, self).open_browser(url=url, browser=browser, alias=alias, remote_url=remote_url,
desired_capabilities=desired_capabilities,
ff_profile_dir=ff_profile_dir)
我在RobotFramework测试中调用此关键字时出现以下错误:
AttributeError:'super'对象没有属性'open_browser'
注意:这对Selenium2Library来说过去了。
答案 0 :(得分:0)
这已添加到RFW SeleniumLibrary文档16.01.2018中: Extending SeleniumLibrary
from SeleniumLibrary import SeleniumLibrary
from SeleniumLibrary.base import keyword
class ExtendedSeleniumLibrary(SeleniumLibrary):
@keyword
def test(self):
return "Extended SeleniumLibrary keyword"