public void ClickCheckbox(string boxName) { var CheckBoxesByClass = driver.FindElements(By.CssSelector("[class='checkbox']")); for (int i = 0; i < CheckBoxesByClass.Count(); i++) { if (CheckBoxesByClass[i].Displayed && CheckBoxesByClass[i].Text == boxName) { CheckBoxesByClass[i].Click(); break; } } }
if(dr.findelement(By.id("ID of Checkbox")).isSelected()) { } else() { dr.findelement(By.id("ID of Checkbox")).click(); }
public void selectCheckBox(WebDriver dri, String locateByPath) { WebElement checkBox; checkBox = dri.findElement(By.name(locateByPath)); if(!checkBox.isSelected()) { checkBox.click(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)