0

How to use parameter for example:

@When("^I enter \"([^\"]*)\" in the Keywords textbox$")
   public void I_enter_in_the_Keywords_textbox(String Job ) throws Throwable{
   driver.findElement(By.id(id)).sendKeys(Job);
 }

In the File I have:

When I enter "<Job>" in the keyword textbox
  |Job|
  |"QA"|
  |"Developer"|

I get Parser Error with gherkin. I tried using datatable, List and every possible way of getting different values but sendkeys doesn't work with Arrays, list or Tables.

Any Help will be greatly appreciated.

orde
  • 5,233
  • 6
  • 31
  • 33
Emily
  • 3
  • 3

1 Answers1

1

You should using Scenario Outline like this:

Scenario Outline:Enter job name

 When I enter "<Job>" in the keyword textbox

Examples:

|Job|

|QA|

|Developer|

Spinoza
  • 11
  • 2
  • Indeed this is the issue. Faced the same problem and eventually found this link: https://github.com/cucumber/cucumber-jvm/issues/367. After that, it worked great – Tash Pemhiwa Sep 01 '14 at 07:46