public void WhenTheUserClicksShortenUrl() { //retrieve values from Scenario Context IWebDriver driver = (IWebDriver)ScenarioContext.Current["DriverSession"]; DriverUtils.ClickOnElement(driver, IndexView.ShortenUrlButton); Thread.Sleep(50); }
public void ThenClickingTheShort_CodeLinkTakesTheUserToTheDesiredPage() { //retrieve values from Scenario Context IWebDriver driver = (IWebDriver)ScenarioContext.Current["DriverSession"]; string desiredUrl = ScenarioContext.Current["UrlToBeShortened"].ToString(); try { DriverUtils.ClickOnElement(driver, IndexView.ShortenedUrlAnchor); } catch (NoSuchElementException e) { Assert.Fail("The link to the Shortened URL was not found: " + e.Message); } //switch to new window. DriverUtils.SwitchToNewWindow(driver); Thread.Sleep(50); string actualUrl = DriverUtils.GetCurrentUrl(driver); Assert.AreEqual(desiredUrl, actualUrl, "The Short Link did now lead the user to the desired URL"); }