How can I Parameterise the bdd step definition to implement if/else conditions?

@When(“^user selects the option \”(.*)\”$”)
public void selectUserType(String option){
if(option==” I am Internal Staff”){
else if (option==”I am External User”){
try {
} catch (IOException e) {

else {
System.out.println(“Invalid Option”);



Hi Lakshay,


I want to define a step something like above to be reused for an external and internal clicks

But with the above method, I am not able to get it done the right away, as it just runs the statement from else condition always. Please can you give me a hint please?

Default Asked on November 26, 2018 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.