Esempio 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));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 public static void SetElement(this ScenarioContext context, PageElement element)
 {
     context[CURRENT_ELEMENT_KEY] = element;
     context.Remove(CURRENT_ELEMENT_GROUP_KEY);
 }