Esempio n. 1
0
        public ComponentScopeLocateResult Find(IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
        {
            int?columnIndex = GetColumnIndex(scope, options, searchOptions);

            if (columnIndex == null)
            {
                if (searchOptions.IsSafely)
                {
                    return(new MissingComponentScopeLocateResult());
                }
                else
                {
                    throw ExceptionFactory.CreateForNoSuchElement(
                              new SearchFailureData
                    {
                        ElementName   = $"\"{options.GetTermsAsString()}\" column header",
                        SearchOptions = searchOptions,
                        SearchContext = scope
                    });
                }
            }

            IComponentScopeLocateStrategy nextStrategy = CreateColumnIndexStrategy(columnIndex.Value);

            return(new SequalComponentScopeLocateResult(scope, nextStrategy));
        }
Esempio n. 2
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            if (component is IItemsControl itemsControl)
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }
Esempio n. 3
0
        private static void InitComponentLocator(UIComponent component, UIComponentMetadata metadata, FindAttribute findAttribute)
        {
            ComponentScopeLocateOptions   locateOptions = CreateScopeLocateOptions(metadata, findAttribute);
            IComponentScopeLocateStrategy strategy      = findAttribute.CreateStrategy(metadata);

            component.ScopeSource = findAttribute.ScopeSource;

            // TODO: Remove this condition when IItemsControl will be removed.
#pragma warning disable CS0618
            if (component is IItemsControl itemsControl)
#pragma warning restore CS0618
            {
                IFindItemAttribute       findItemAttribute       = GetPropertyFindItemAttribute(metadata);
                IItemElementFindStrategy itemElementFindStrategy = findItemAttribute.CreateStrategy(component, metadata);
                itemsControl.Apply(itemElementFindStrategy);
            }

            component.ScopeLocator = new StrategyScopeLocator(component, strategy, locateOptions);
        }
Esempio n. 4
0
        private XPathComponentScopeLocateResult[] ExecuteStrategyAndResolveResults(IComponentScopeLocateStrategy strategy, IWebElement scope, ComponentScopeLocateOptions options, SearchOptions searchOptions)
        {
            ComponentScopeLocateResult result = strategy.Find(scope, options, searchOptions);

            return(ResolveScopeLocateResult(result, scope, searchOptions));
        }
Esempio n. 5
0
 public StrategyScopeLocator(UIComponent component, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions)
 {
     this.component          = component;
     this.strategy           = strategy;
     this.scopeLocateOptions = scopeLocateOptions;
 }
Esempio n. 6
0
 public SequalComponentScopeLocateResult(IWebElement scopeSource, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
 {
     ScopeSource        = scopeSource;
     Strategy           = strategy;
     ScopeLocateOptions = scopeLocateOptions;
 }
Esempio n. 7
0
 public SequalComponentScopeLocateResult(By scopeSourceBy, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
 {
     ScopeSourceBy      = scopeSourceBy;
     Strategy           = strategy;
     ScopeLocateOptions = scopeLocateOptions;
 }
Esempio n. 8
0
 public SequalComponentScopeLocateResult(IEnumerable <IWebElement> scopeSources, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
 {
     ScopeSources       = scopeSources;
     Strategy           = strategy;
     ScopeLocateOptions = scopeLocateOptions;
 }
Esempio n. 9
0
 public SequalComponentScopeLocateResult(IWebElement scopeSource, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
     : this(new[] { scopeSource ?? throw new ArgumentNullException(nameof(scopeSource)) }, strategy, scopeLocateOptions)
 public StrategyScopeLocator(UIComponent component, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions)
 {
     this.component = component;
     this.strategy = strategy;
     this.scopeLocateOptions = scopeLocateOptions;
 }
 public SequalComponentScopeLocateResult(IWebElement scopeSource, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
 {
     ScopeSource = scopeSource;
     Strategy = strategy;
     ScopeLocateOptions = scopeLocateOptions;
 }
 public SequalComponentScopeLocateResult(By scopeSourceBy, IComponentScopeLocateStrategy strategy, ComponentScopeLocateOptions scopeLocateOptions = null)
 {
     ScopeSourceBy = scopeSourceBy;
     Strategy = strategy;
     ScopeLocateOptions = scopeLocateOptions;
 }