Selenium 我在执行行为代码时出现以下错误。有人能告诉我为什么会发生这个问题吗
错误: 代码:Selenium 我在执行行为代码时出现以下错误。有人能告诉我为什么会发生这个问题吗,selenium,appium,python-behave,Selenium,Appium,Python Behave,错误: 代码: step\u impl函数的第一个参数是context,而不是self,因此出现错误。如果您感兴趣,可以学习一些关于位置和关键字参数的知识 就是 @when('the user clicks on "Login"') def step_impl(self,context): """ :type context: behave.runner.Context """ homePage.loginButton(self) 如果您试图在没有参数的情况下调
step\u impl
函数的第一个参数是context
,而不是self
,因此出现错误。如果您感兴趣,可以学习一些关于位置
和关键字
参数的知识
就是
@when('the user clicks on "Login"')
def step_impl(self,context):
"""
:type context: behave.runner.Context
"""
homePage.loginButton(self)
如果您试图在没有参数的情况下调用
step_impl()
,则需要获取上下文
参数。
@when('the user clicks on "Login"')
def step_impl(self,context):
"""
:type context: behave.runner.Context
"""
homePage.loginButton(self)
@when('the user clicks on "Login"')
def step_impl(context):
"""
:type context: behave.runner.Context
"""
homePage.loginButton(self) # This line of code will break