//private static Dictionary<String, Uri> _environmentMap = new Dictionary<String, Uri>(StringComparer.InvariantCultureIgnoreCase) //{ // { "DEV", new Uri("http://ta.dev.clubspark.co/") }, // { "TEST", new Uri("http://ta.test.clubspark.co/") }, // { "STAGE", new Uri("http://ta.stage.clubspark.co/") }, // { "PREPROD", new Uri("http://ta.preprod.clubspark.co/") }, // { "PROD", new Uri("https://bookacourt.tennis.com.au/") }, //}; //private static Uri _baseURL = _environmentMap[SeleniumContext.ENVIRONMENT]; //public static void GoToRelativeUrl(this IWebDriver driver, String relativeUrl, params String[] args) //{ // String absoluteUrl = new Uri(ExtensionMethods._baseURL, String.Format(relativeUrl, args)).AbsoluteUri; // Console.WriteLine("[{0}] Navigate", absoluteUrl); // driver.Navigate().GoToUrl(absoluteUrl); // Assert.IsFalse(driver.Url.Contains("Error?aspxerrorpath"), String.Format("Error loading URL {0}", absoluteUrl)); // var headings = driver.FindElements(new Sizzle("body span h1")); // if (headings.Count == 1) // { // Assert.IsFalse(headings.First().Text == @"Server Error in '/' Application.", String.Format("Error loading URL {0}", absoluteUrl)); // } //} public static IWebElement WaitForElement(this IWebDriver driver, String selector, String message = "Error finding element", Int32 timeout = 30000) { var wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(timeout)); wait.Until((d) => { return(driver.FindElements(new Sizzle(selector)).Any()); }); return(driver.AssertElement(selector, message)); }