public void ClickAllLeftMenuLinks() { _driver.Navigate().GoToUrl("http://localhost/litecard/admin"); _wait.Until(ExpectedConditions.TitleIs("My Store")); LoginPage loginPage = new LoginPage(_driver); AdminPage adminPage = loginPage.DoLogin(@"admin", @"admin"); int menuItemsCount = adminPage.GetMainMenuItemsCount(); for (int i = 1; i <= menuItemsCount; i++) { adminPage.ClickMainMenuItem(i); Assert.True(adminPage.IsH1Exists()); int subMenuItemsCount = adminPage.GetSubMenuItemsCount(); if (subMenuItemsCount <= 0) { continue; } for (int n = 1; n <= subMenuItemsCount; n++) { adminPage.ClickSubMenuItem(n); Assert.True(adminPage.IsH1Exists()); } } }