public void TypeIntoTextBoxLabelled(string p0, string p1) { var xPath = string.Format(@"//label[contains(text(),'{0}')]", p1); var label = Br.FindElement(By.XPath(xPath)); ClearAndType(p0, label.GetAttribute("for")); }
public void SelectFromTheDropdown(string p0, string p1) { var xPath = string.Format(@".//option[contains(text(),'{0}')]", p0); var ddl = Br.FindElement(By.Id(p1)); ddl.FindElement(By.XPath(xPath)).Click(); }
public void ClickTheCheckboxLabelled(string p0) { var xPath = string.Format(@"//label[contains(text(),'{0}')]", p0); var label = Br.FindElement(By.XPath(xPath)); Br.FindElement(By.Id(label.GetAttribute("for"))).Click(); }
protected void ClearAndType(string p0, string p1) { Br.FindElement(By.Id(p1)).Clear(); p0 = (p0.Contains(@"uniquevalue")) ? p0.Replace(@"uniquevalue", GuidString()) : p0; p0 = (p0.Contains(@"cache")) ? FeatureContext.Current.Get <string>(p0.Substring(p0.LastIndexOf('.') + 1)) : p0; p0 = (p0.Contains(@"config")) ? ConfigurationManager.AppSettings[p0.Substring(p0.LastIndexOf('.') + 1)] : p0; Br.FindElement(By.Id(p1)).SendKeys(p0); }
public void ThenTheDivWithShouldContainTheText(string p0, string p1, string p2) { IWebElement div = null; switch (p0.ToUpper()) { case "TITLE": div = Br.FindElement(By.XPath(@"//div[@title='" + p1 + "']")); break; case "ID": div = Br.FindElement(By.Id(p1)); break; } Assert.IsNotNull(div); Assert.IsTrue(div.Text.Contains(p2)); }
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)); }
protected void ClickWithRetry(By by) { var attempts = 0; while (attempts < 2) { try { Br.FindElement(by).Click(); break; } catch (StaleElementReferenceException e) { } attempts++; } }
public void ClickHyperLink(string p0) { Br.FindElement(By.XPath(@"//a[text()='" + p0 + "']")).Click(); }
public void SelectTheNthCheckbox(string p0) { var xPath = string.Format(@"//input[@type='checkbox'][{0}]", GetIndexFromPosition(p0)); Br.FindElement(By.XPath(xPath)).Click(); }