public void ThenTheTextShouldBeDisplayed(string p0) { var xPath = string.Format(@"//*[contains(text(),'{0}')]", p0); var list = Br.FindElements(By.XPath(xPath)); Assert.IsTrue(list.Any()); }
public void ValidationMessageIsDisplayed(string p0) { var msgs = Br.FindElements( By.XPath("//div[contains(concat(' ', @class, ' '), ' validation-summary-errors ')]/ul/li")); Assert.IsTrue(msgs.Any(e => e.Text == p0)); }
public void SelectFromTheDropdownLabelled(string p0, string p1) { var id = string.Empty; var xPath = string.Format(@"//label[contains(text(),'{0}')]", p1); var labels = Br.FindElements(By.XPath(xPath)); foreach (var label in labels.Where(label => label.GetAttribute("for") != null)) { id = label.GetAttribute("for"); break; } xPath = string.Format(@".//option[contains(text(),'{0}')]", p0); var ddl = Br.FindElement(By.Id(id)); ClickWithRetry(By.XPath(xPath)); }
public void ClickTheNthButtonWithSpecificProperty(string p0, string p1, string p2) { var pos = int.Parse(GetIndexFromPosition(p0)) - 1; switch (p1.ToUpper()) { case "TITLE": Br.FindElements(By.XPath(@"//input[@title='" + p2 + "']"))[pos].Click(); break; case "LABEL": Br.FindElements(By.XPath(@"//input[@value='" + p2 + "']"))[pos].Click(); break; case "ID": Br.FindElements(By.Id(p2))[pos].Click(); break; } }