My Page has single checkBox for two fields each and I need to pass the option to check or not as a generic method. Tried with if else loop and switch case but not working.
My Code:
public void checkBoxClick(String checkBox, String propName){
switch (checkBox) {
case "Checked":
WebElement element=driver.findElement(By.name(propName));
element.click();
break;
case "UnChecked":
break;
}
}
Step-define file:
@Then("^Enter (.*) also check (.*) and (.*)$")
public void enter_rucNo_check_transit(String checkBox1, String checkBox2) throws InterruptedException {
driver_interactions.checkBoxClick("mrclBulkHeader.transit", checkBox1);
driver_interactions.checkBoxClick("mrclBulkHeader.airTransit", checkBox2);
}
I don't know why the checkBox doesn't get click. Can anyone correct me.