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); } }
public void Add(PageObjectConfiguration pageConfig) { BaseAdd(pageConfig); }
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; }