public void GoTo(string siteLocation) { string expectedPageTitle; switch (siteLocation) { case "BBCHome": BBCHome.Click(); expectedPageTitle = "BBC - Home"; break; case "NewsHome": News.Click(); expectedPageTitle = "Home - BBC News"; break; case "SportsHome": Sport.Click(); expectedPageTitle = "BBC Sport - Sport"; break; case "FootballHome": Football.Click(); expectedPageTitle = "BBC Sport - Football"; break; default: expectedPageTitle = "Unknown location"; break; } var wait = Browser.Wait(); try { wait.Until(p => p.Title == expectedPageTitle); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }