protected void ClickItems(T value, ClickItemPredicate predicate) { List <T> individualValues = GetIndividualValues(value).ToList(); IWebElement[] elements = GetItemElements(); foreach (IWebElement element in elements) { T elementValue = GetElementValue(element); bool isInValue = individualValues.Contains(elementValue); if (isInValue) { individualValues.Remove(elementValue); } if (predicate(isInValue, element.Selected)) { element.Click(); } } if (individualValues.Any()) { throw ExceptionFactory.CreateForNoSuchElement( "Unable to locate element{0}: {1}.".FormatWith( individualValues.Count > 1 ? "s" : null, ConvertIndividualValuesToString(individualValues, true))); } }
protected void ClickItems(T value, ClickItemPredicate predicate) { List <T> individualValues = GetIndividualValues(value).ToList(); IWebElement[] elements = GetItemElements(); foreach (IWebElement element in elements) { T elementValue = GetElementValue(element); bool isInValue = individualValues.Contains(elementValue); if (isInValue) { individualValues.Remove(elementValue); } if (predicate(isInValue, element.Selected)) { element.Click(); } } if (individualValues.Any()) { throw ExceptionFactory.CreateForNoSuchElement( new SearchFailureData { ElementName = $"{ConvertIndividualValuesToString(individualValues, true)} checkbox element{(individualValues.Count > 1 ? "s" : null)} of {ComponentFullName}" }); } }