public static void ViewModelByRating(int rank) { Hooks.Driver.Url = ConfigurationManager.AppSettings["Website"] + "overall"; WaitPageToLoad(); var tablePage = rank / 5 + (rank % 5 == 0 ? 0 : 1); var posInPage = rank % 5 + (rank % 5 == 0 ? 5 : 0); var page = new MakerPage(Hooks.Driver, true); page.GoToPage(tablePage.ToString()); var watch = Stopwatch.StartNew(); try { while (watch.Elapsed < TimeSpan.FromSeconds(5)) { if (page.CarTable[posInPage].Rank == rank.ToString()) { break; } } } catch (StaleElementReferenceException) { } if (page.CarTable[posInPage].Rank != rank.ToString()) { throw new ApplicationException($"Model in Rank #{rank} was not found"); } page.CarTable[posInPage].Image.Click(); WaitPageToLoad(); }
public TableActionsSteps(IWebDriver driver) { page = new MakerPage(driver); }