Exemplo n.º 1
0
        public static PageElement GetElementByAlias(PageCore page, PageElement currentElement, string alias)
        {
            if (page == null)
            {
                throw new ArgumentException("Страница на которой происходит поиск не может иметь пустое значение");
            }

            PageElementCore elementCore = null;

            if (currentElement != null && currentElement.TryFindElementByAlias(alias, out elementCore))
            {
                PageElement element = elementCore as PageElement;
                if (element != null)
                {
                    return(element);
                }
            }

            if (page.TryFindElementByAlias(alias, out elementCore))
            {
                PageElement element = elementCore as PageElement;
                if (element != null)
                {
                    return(element);
                }
            }

            string xPath = Alias.ResolveAsString(alias);

            return(page.FindElement(xPath));
        }
Exemplo n.º 2
0
        public static PageElementCollection GetElementCollectionByAlias(PageCore page, PageElement currentElement, string groupAlias)
        {
            if (page == null)
            {
                throw new ArgumentException("Страница на которой происходит поиск не может иметь пустое значение");
            }

            PageElementCore element = null;

            if (currentElement != null && currentElement.TryFindElementByAlias(groupAlias, out element))
            {
                PageElementCollection collection = element as PageElementCollection;
                if (collection != null)
                {
                    return(collection);
                }
            }
            if (page.TryFindElementByAlias(groupAlias, out element))
            {
                PageElementCollection collection = element as PageElementCollection;
                if (collection != null)
                {
                    return(collection);
                }
            }

            string xPath = Alias.ResolveAsString(groupAlias);

            return(page.FindElementCollection(xPath));
        }
Exemplo n.º 3
0
        public static PageElementCollection GetElementCollectionByAlias(string groupAlias)
        {
            PageCore              currentPage    = ScenarioContext.Current.Page();
            PageElement           currentElement = ScenarioContext.Current.Element();
            PageElementCollection element        = GetElementCollectionByAlias(currentPage, currentElement, groupAlias);

            return(element);
        }
Exemplo n.º 4
0
        public static PageElement GetElementByAlias(string alias)
        {
            PageCore    currentPage    = ScenarioContext.Current.Page();
            PageElement currentElement = ScenarioContext.Current.Element();
            PageElement element        = PageElement.GetElementByAlias(currentPage, currentElement, alias);

            return(element);
        }
Exemplo n.º 5
0
        public static PageCore TryResolveAsPage(string pageAlias)
        {
            PageCore page = null;

            Type pageType = null;

            if (!Alias.PageAliases.TryGetValue(pageAlias, out pageType))
            {
                return(null);
            }
            page = Activator.CreateInstance(pageType) as PageCore;
            return(page);
        }
Exemplo n.º 6
0
 public PageElementCollection(PageCore page, string xPath) : base(page, xPath)
 {
 }
Exemplo n.º 7
0
 //[AAAStep("TryResolveAsPage")]
 public static void SetPage(this ScenarioContext context, PageCore page)
 {
     context[CURRENT_PAGE_KEY] = page;
 }
Exemplo n.º 8
0
 public PageElement(PageCore page, string xPath) : base(page, xPath)
 {
 }
Exemplo n.º 9
0
 public PageElementCore(PageCore page, string xPath)
 {
     this.Page  = page;
     this.XPath = xPath;
 }