示例#1
0
        private void ParsePageConfig(PageObjectConfiguration pageObjectConfig)
        {
            PageObjectConfiguration basePage = GetBasePage(pageObjectConfig);
            if (basePage != null)
            {
                ParsePageConfig(basePage);
            }

            foreach (ElementConfiguration ec in pageObjectConfig.Elements)
            {
                string value = ec.Value;
                FindBy findBy = ec.FindBy;

                if (ec.IsParameterized)
                {
                    Func<string, string[], IWebElement> parameterizedFinder = (str, args) => ParameterizedFindElementBy(value, findBy, args);
                    ec.ParameterizedFinder = parameterizedFinder;
                }
                else
                {
                    Func<string, IWebElement> finder = (str) => FindElementBy(value, findBy);
                    ec.Finder = finder;
                }

                _cachedQueries.Add(ec.Name, ec);
            }

            foreach (var kp in pageObjectConfig.Values)
            {
                pageObjectConfig.Type.GetProperty(kp.Key).SetValue(this, kp.Value, null);
            }
        }
示例#2
0
 public void Add(PageObjectConfiguration pageConfig)
 {
     BaseAdd(pageConfig);
 }
示例#3
0
        private PageObjectConfiguration GetBasePage(PageObjectConfiguration pageObjectConfig)
        {
            PageObjectConfiguration result = null;

            if (!string.IsNullOrEmpty(pageObjectConfig.BasePageName))
            {
                result = ApplicationObjectConfiguration.Instance.Pages.OfType<PageObjectConfiguration>().FirstOrDefault(p => p.Name == pageObjectConfig.BasePageName);
            }

            return result;
        }
 public void Add(PageObjectConfiguration pageConfig)
 {
     BaseAdd(pageConfig);
 }