title: How I can pull data from a Cucumber table in Javascript?
body: <p>I want to perform a test case where I'm trying to login with different credentials and check the error message. How this can be done in Cucumber?</p>
  <pre><code>Feature: Login
  
  Login Test Suite
  
  Background: 
    Given I'm on the login page
  
  Scenario: 01. Should not be able to login with invalid cred
  When I log in with &quot;username&quot; and &quot;password&quot;
      |  username   | password | ExpectedError                     |
      |    asdasd   | anything | Invalid credentials specified     |
      |             | anything | Please specify a username         |
      |    asdasd   |          | Please specify a password         |
      |             |          | No username or password specified |
  Then An error msg should appear
  </code></pre>
  <p>Here's where I want to pass the two args, username and password:</p>
  <pre><code>When('I log in with (string) and (string)', (username,password) =&gt; {
      p.loginWith(username, password)
  })
  </code></pre>