/// <summary> /// Gets the current category. /// </summary> /// <returns></returns> public virtual string GetCurrentCategory() { var selectedCategory = CategoriesComponent.GetItems() .FirstOrDefault(e => e.Classes().Contains("active")); return(selectedCategory?.TextHelper().InnerText); }
private void SelectCategoryHelper(string category, StringComparison stringComparison) { var foundItem = false; var links = CategoriesComponent.GetItems() .Select(e => e.FindElement(By.CssSelector("a"))); foreach (var item in links) { var text = item.TextHelper().InnerText; var matches = String.Equals( category, text, stringComparison); if (matches) { foundItem = true; item.Click(); break; } } if (!foundItem) { throw new NoSuchElementException(); } }
/// <summary> /// Gets the categories. /// </summary> /// <returns></returns> public virtual IEnumerable <string> GetCategories() { var categories = CategoriesComponent .GetItems() .Select(e => e.FindElement(linkSelector) .TextHelper() .InnerText); return(categories); }