So I'm using WebdriverIO with cucumber framework but I have encountered myself with the following situation: The feature file comes like this:

Scenario Outline: Scenario

Given situation A
When I enter a valid "<Brand>" credit card number: "<Number>" 
And the credit card CVC is "<CVC>"
And the credit card expiration date is "<ExpirationDate>"
Then Output here

  | Number|Brand| CVC | ExpirationDate | 
  | 4242424242422121 | Visa | 123 | 11/2020 |  

On the test script I got something like:

const { Given, When, Then, And } = require('cucumber')

And when I try to call the "And" method like this:

 and('the credit card CVC is "([^"]*)"', function(CVC)
   //code here

I receive an error that says: "And" is not a function.

We cannot include the "And" "But" keywords on Webdriverio?

If so, what would be an alternative to make this type of scenarios to work?

Thanks in advance for the help!

1 Answer 1


"And" is replaced internally with either "Given", "When", or "Then" since it is an extension of one of those lines.

In your case, replace:

and('the credit card CVC is "([^"]*)"', function(CVC) { //code here })


when('the credit card CVC is "([^"]*)"', function(CVC) { //code here })

And make the same change with the line that follows.

  • Great! I understand now. Thank you very much for your help and response. Commented Jul 9, 2018 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.