Emily
Emily

Reputation: 3

Automating Browser with Cucumber with the use of Parameter

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.

Upvotes: 0

Views: 150

Answers (1)

Spinoza
Spinoza

Reputation: 11

You should using Scenario Outline like this:

Scenario Outline:Enter job name

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

Examples:

|Job|

|QA|

|Developer|

Upvotes: 1

Related Questions