public MainMenuPage(NgWebDriver driver) : base(driver, null) { // Uncomment this out if you want to clear the cache. //ClearCacheCmd.ClearCache(driver); _nav = _ngDriver.FindElement(By.CssSelector(".nav.navbar-nav")); _navbar = _ngDriver.FindElement(By.CssSelector(".nav.navbar-nav")); }
public CustomersPage(NgWebDriver driver) { ngDriver = driver; if (!ngDriver.Url.EndsWith("#/customers")) { throw new InvalidOperationException("This is not the customers page"); } cardViewButtonElement = ngDriver.FindElement(By.XPath("//ul[@class='nav']//li[contains(.,'Card View')]")); cardViewElement = ngDriver.FindElement(By.ClassName("cardContainer")); listViewButtonElement = ngDriver.FindElement(By.XPath("//ul[@class='nav']//li[contains(.,'List View')]")); listViewElement = ngDriver.FindElement(By.ClassName("gridContainer")); }
public List<ElementInfo> ElementsByCssSelector(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null) { return list(By.CssSelector(repeatingExpr), resetMethod, parent); }
public List<ElementInfo> ElementsByBinding(string binding, Action resetMethod = null, NgWebElement parent = null) { return list(NgBy.Binding(binding), resetMethod, parent); }
public ElementInfo ElementByXPath(string xpath, Action resetMethod = null, NgWebElement parent = null) { return find(By.XPath(xpath), resetMethod, parent); }
public ElementInfo ElementByTagName(string tagName, Action resetMethod = null, NgWebElement parent = null) { return find(By.TagName(tagName), resetMethod, parent); }
//private ElementInfo find(By by) //{ // try // { // NgWebElement ele = _ngDriver.FindElement(by); // return new ElementInfo(ref ele); // } // catch(Exception) // { // return null; // } //} private ElementInfo find(By by, Action resetMethod, NgWebElement parent = null) { NgWebElement ele; if (parent != null) { try { ele = parent.FindElement(by); } catch (Exception) { ele = null; } return new ElementInfo(ele, resetMethod); } else { try { ele = _ngDriver.FindElement(by); } catch (Exception) { ele = null; } return new ElementInfo(ele, resetMethod); } }
public List<ElementInfo> ElementsByXPath(string xpath, Action resetMethod = null, NgWebElement parent = null) { return list(By.XPath(xpath), resetMethod, parent); }
public ElementInfo ElementByID(string id, Action resetMethod = null, NgWebElement parent = null) { return find(By.Id(id), resetMethod); }
public ElementInfo ElementByCssSelector(string css, Action resetMethod = null, NgWebElement parent = null) { return find(By.CssSelector(css), resetMethod, parent); }
public ElementInfo ElementByBinding(string bindingExpr, Action resetMethod = null, NgWebElement parent = null) { return find(NgBy.Binding(bindingExpr), resetMethod, parent); }
public ElementInfo ElementByAttrName(string attrName, Action resetMethod = null, NgWebElement parent = null) { return find(By.Name(attrName), resetMethod, parent); }
public ElementInfo(IWebElement ele, Action resetMethod = null) { _ele = new NgWebElement(Driver, ele); _resetMethod = resetMethod; }
public ElementInfo(NgWebElement ele, Action resetMethod = null) { _ele = ele; _resetMethod = resetMethod; }
public List<ElementInfo> ElementsByRepeater(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null) { return list(NgBy.Repeater(repeatingExpr), resetMethod, parent); }
public List<ElementInfo> ElementsByTagName(string tagName, Action resetMethod = null, NgWebElement parent = null) { return list(By.TagName(tagName), resetMethod, parent); }
public ElementInfo ElementByLinkText(string linkText, Action resetMethod = null, NgWebElement parent = null) { return find(By.LinkText(linkText), resetMethod, parent); }
public ElementInfo SelectedDropdownValueByModel(string modelAttribute, Action resetMethod = null, NgWebElement parent = null) { return find(NgBy.SelectedOption(modelAttribute), resetMethod); //try //{ // // TODO: run some more benchmarks as this might be faster... // //var selected = _ngDriver.FindElement(NgBy.Model(modelAttribute)); // //var selectedValue = selected.FindElement(NgBy.SelectedOption(modelAttribute)); // //var selectedValue = _ngDriver.FindElement(NgBy.SelectedOption(modelAttribute)); // //return selectedValue.Text; // CurrentElement = new ElementInfo(_ngDriver.FindElement(NgBy.SelectedOption(modelAttribute))); // return CurrentElement; //} //catch (Exception) //{ // return null; //} }
public ElementInfo ElementByModel(string modelAttribute, Action resetMethod = null, NgWebElement parent = null) { return find(NgBy.Model(modelAttribute), resetMethod, parent); }
private List<ElementInfo> list(By by, Action resetMethod, NgWebElement parent = null) { List<NgWebElement> protractorList = parent != null ? parent.FindElements(by).ToList() : _ngDriver.FindElements(by).ToList(); List<ElementInfo> elementList = new List<ElementInfo>(); foreach (var item in protractorList) { try { elementList.Add(new ElementInfo(item, () => new ElementInfo(null))); } catch (Exception) { } } return elementList; }
public ElementInfo ElementByRepeater(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null) { return find(NgBy.Repeater(repeatingExpr), resetMethod, parent); }