public ManufacturerPage OpenRandomManufacturerPage(PageBase currentPage) { // Open brand menu var menuItems = currentPage.Menu.OpenMenu("Бренды"); _wait.Until(ExpectedConditions.ElementIsVisible( By.CssSelector("li.megamenu-parent-block a.megamenu-parent-img img[title=\"Swiss Military\"]"))); // Click on Swiss Military image randomSelector.Select(menuItems).Title.Click(); return(ManufacturerPage.WaitForPage(_driver)); }
public ManufacturerPage OpenManufacturerPage(string manufacturer) { var menuItems = _currentPage.Menu.OpenMenu("Бренды"); _wait.Until(ExpectedConditions.ElementIsVisible( By.CssSelector($"li.megamenu-parent-block a.megamenu-parent-img img[title=\"{manufacturer}\"]"))); var menuItem = menuItems.FirstOrDefault(item => item.Image.GetAttribute("title") == manufacturer); if (menuItem == null) { throw new Exception($"Could not find item for manufacturer '{manufacturer}' in brands menu"); } menuItem.Image.Click(); return((ManufacturerPage)(_currentPage = ManufacturerPage.WaitForPage(_driver))); }