visual studio with selenium webdrivers , check all checkboxes except one checkbox
I have a web page with lot of check boxes, as per functionality I have to check all the checkboxes expect one checkbox.
so I am trying to achieve like this but its not working.
public void checkAllCheckboxes()
string checkBoxElementSelector = input[@type='checkbox' and not(@checked='checked') and @id="ctl01_test"]
ReadOnlyCollection<IWebElement> allcheckBoxElements = _driver.FindElements(By.CssSelector(checkBoxElemen tSelector));
foreach (IWebElement checkBox in allcheckBoxElements) ' for all checkboxes
if (!_driver.FindElements(By.Id.Equals("ctl01_test")) ) ' this is the one I dont need to check the checkbox
the above one is not working, can any one help me out?
Last edited by gsg; 01-27-2016 at 06:31 PM.
I think you should try this.
if!("ctl01_test" == checkBox.GetAttribute("ID)) 'this is the one I dont need to check the checkbox