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

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

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.