【发布时间】:2018-05-27 16:13:55
【问题描述】:
我正在尝试扩展 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 Test 中调用此关键字时出现以下错误:
AttributeError: 'super' object has no attribute 'open_browser'
注意:这在过去适用于 Selenium2Library。
【问题讨论】:
-
是的,新的 SeleniumLibrary 完全用某种动态 api 重新实现,使其更难(或至少没有记录)扩展。
标签: python python-2.7 selenium robotframework