You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think this is a bug as much as lack of coding experience. I'm porting over some very rudimentary lettuce_webdriver features and steps, and I'm struggling for a clean replacement for "I should see..."
One such feature line for this is:
Scenario: Testing Webdriver
When I open the url "http://my.login.page"
Then I should see "Forgot Your Password?"
Of the three definitions below, only the first one works. The latter two are not recognized and behave suggests a snippet like the first one.
@then(u'I should see "Forgot Your Password?"')
def step_impl(context):
assert context.behave_driver.element_contains('body', 'Forgot Your Password?')
@then(u'I should see "([^"]*)?"')
def step_impl(context, value):
assert context.behave_driver.element_contains('body', value)
@then(u'I should see "([^"]*)?"')
def step_impl(context, value):
context.execute_steps( u"""
then I expect that element "body" contains the text "{text}')
""").format(text = value)
The text was updated successfully, but these errors were encountered:
By default, the 'parse' matcher is in use.
Defining a generic step for this use should be as simple as the following:
@then(u'I should see "{text}"')defexpect_some_text(context, text):
assertcontext.behave_driver.element_contains('body', text)
The problem you're encountering with the latter two steps is that, in order to use regex matching, you'd need to change the step matcher first.
So you could define the same kind of step using the regex matcher this way
frombehaveimportuse_step_matcheruse_step_matcher('re')
@then(u'I should see "([^"]*)?"')defstep_impl(context, value):
assertcontext.behave_driver.element_contains('body', value)
If you change the matcher, don't forget to change it back as needed, so your other steps don't unexpectedly stop working.
I don't think this is a bug as much as lack of coding experience. I'm porting over some very rudimentary lettuce_webdriver features and steps, and I'm struggling for a clean replacement for "I should see..."
One such feature line for this is:
Of the three definitions below, only the first one works. The latter two are not recognized and behave suggests a snippet like the first one.
The text was updated successfully, but these errors were encountered: