Ejemplo n.º 1
0
 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"));
 }
Ejemplo n.º 2
0
        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"));
        }
Ejemplo n.º 3
0
 public List<ElementInfo> ElementsByCssSelector(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null)
 {
     return list(By.CssSelector(repeatingExpr), resetMethod, parent);
 }
Ejemplo n.º 4
0
 public List<ElementInfo> ElementsByBinding(string binding, Action resetMethod = null, NgWebElement parent = null)
 {
     return list(NgBy.Binding(binding), resetMethod, parent);
 }
Ejemplo n.º 5
0
 public ElementInfo ElementByXPath(string xpath, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.XPath(xpath), resetMethod, parent);
 }
Ejemplo n.º 6
0
 public ElementInfo ElementByTagName(string tagName, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.TagName(tagName), resetMethod, parent);
 }
Ejemplo n.º 7
0
 //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);
     }
 }
Ejemplo n.º 8
0
 public List<ElementInfo> ElementsByXPath(string xpath, Action resetMethod = null, NgWebElement parent = null)
 {
     return list(By.XPath(xpath), resetMethod, parent);
 }
Ejemplo n.º 9
0
 public ElementInfo ElementByID(string id, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.Id(id), resetMethod);
 }
Ejemplo n.º 10
0
 public ElementInfo ElementByCssSelector(string css, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.CssSelector(css), resetMethod, parent);
 }
Ejemplo n.º 11
0
 public ElementInfo ElementByBinding(string bindingExpr, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(NgBy.Binding(bindingExpr), resetMethod, parent);
 }
Ejemplo n.º 12
0
 public ElementInfo ElementByAttrName(string attrName, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.Name(attrName), resetMethod, parent);
 }
Ejemplo n.º 13
0
 public ElementInfo(IWebElement ele, Action resetMethod = null)
 {
     _ele = new NgWebElement(Driver, ele);
     _resetMethod = resetMethod;
 }
Ejemplo n.º 14
0
 public ElementInfo(NgWebElement ele, Action resetMethod = null)
 {
     _ele = ele;
     _resetMethod = resetMethod;
 }
Ejemplo n.º 15
0
 public List<ElementInfo> ElementsByRepeater(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null)
 {
     return list(NgBy.Repeater(repeatingExpr), resetMethod, parent);
 }
Ejemplo n.º 16
0
 public List<ElementInfo> ElementsByTagName(string tagName, Action resetMethod = null, NgWebElement parent = null)
 {
     return list(By.TagName(tagName), resetMethod, parent);
 }
Ejemplo n.º 17
0
 public ElementInfo ElementByLinkText(string linkText, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(By.LinkText(linkText), resetMethod, parent);
 }
Ejemplo n.º 18
0
 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;
     //}
 }
Ejemplo n.º 19
0
 public ElementInfo ElementByModel(string modelAttribute, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(NgBy.Model(modelAttribute), resetMethod, parent);
 }
Ejemplo n.º 20
0
        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;
        }
Ejemplo n.º 21
0
 public ElementInfo ElementByRepeater(string repeatingExpr, Action resetMethod = null, NgWebElement parent = null)
 {
     return find(NgBy.Repeater(repeatingExpr), resetMethod, parent);
 }