protected internal override void Execute <TOwner>(TriggerContext <TOwner> context) { ScopeSource actualScopeSource = scopeSource ?? context.Component.ScopeSource; IWebElement scopeElement = actualScopeSource.GetScopeElement(context.Component); WaitUnit[] waitUnits = GetWaitUnits(Until); Wait(scopeElement, waitUnits); }
public StrategyScopeLocatorExecutionData( UIComponent component, ScopeSource scopeSource, bool isSafely, IEnumerable <StrategyScopeLocatorLayerExecutionUnit> layerUnits, StrategyScopeLocatorExecutionUnit finalUnit) { Component = component; ScopeSource = scopeSource; IsSafely = isSafely; LayerUnits = layerUnits; FinalUnit = finalUnit; }
public List <InstructionIDNamePair> GetAllSubroutines(ScopeSource source) { var bhavs = GetAllResource <BHAV>(source); var output = new List <InstructionIDNamePair>(); foreach (var bhav in bhavs) { output.Add(new InstructionIDNamePair(bhav.ChunkLabel, bhav.ChunkID)); } output = output.OrderBy(o => o.Name).ToList(); return(output); }
public string GetFilename(ScopeSource scope) { switch (scope) { case ScopeSource.Global: return("global"); case ScopeSource.SemiGlobal: return(SemiGlobalName); default: return(Object.Resource.Name); } }
public T GetResource <T>(ushort id, ScopeSource source) { switch (source) { case ScopeSource.Private: return(Object.Resource.Get <T>(id)); case ScopeSource.SemiGlobal: return(SemiGlobal.Get <T>(id)); case ScopeSource.Global: return(Globals.Resource.Get <T>(id)); default: return(default(T)); } }
public List <T> GetAllResource <T>(ScopeSource source) { switch (source) { case ScopeSource.Private: return(Object.Resource.List <T>()); case ScopeSource.SemiGlobal: return((SemiGlobal == null) ? new List <T>():SemiGlobal.List <T>()); case ScopeSource.Global: return(Globals.Resource.List <T>()); default: return(new List <T>()); } }
public List <T> GetAllResource <T>(ScopeSource source) { switch (source) { case ScopeSource.Private: return((Resource is GameGlobalResource)? new List <T>():Resource.List <T>()); case ScopeSource.SemiGlobal: return((Resource.SemiGlobal == null) ? new List <T>():Resource.SemiGlobal.List <T>()); case ScopeSource.Global: return(EditorScope.Globals.Resource.List <T>()); default: return(new List <T>()); } }
public static IWebElement GetScopeElement(this ScopeSource scopeSource, UIComponent component) { switch (scopeSource) { case ScopeSource.Parent: return(component.Parent.Scope); case ScopeSource.Grandparent: return(component.Parent.Parent.Scope); case ScopeSource.PageObject: return(component.Owner.Scope); case ScopeSource.Page: return(component.Driver.Get(By.TagName("body"))); default: throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource)); } }
public static IWebElement GetScopeElementUsingParent <TOwner>(this ScopeSource scopeSource, IUIComponent <TOwner> parentComponent) where TOwner : PageObject <TOwner> { switch (scopeSource) { case ScopeSource.Parent: return(parentComponent.Scope); case ScopeSource.Grandparent: return(parentComponent.Parent.Scope); case ScopeSource.PageObject: return(parentComponent.Owner.Scope); case ScopeSource.Page: return(AtataContext.Current.Driver.Get(By.TagName("body"))); default: throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource)); } }
public static ISearchContext GetScopeContextUsingParent <TOwner>(this ScopeSource scopeSource, IUIComponent <TOwner> parentComponent) where TOwner : PageObject <TOwner> { switch (scopeSource) { case ScopeSource.Parent: return(parentComponent.ScopeContext); case ScopeSource.Grandparent: return((parentComponent.Parent ?? throw UIComponentNotFoundException.ForParentOf(parentComponent.ComponentFullName)).ScopeContext); case ScopeSource.PageObject: return(parentComponent.Owner.ScopeContext); case ScopeSource.Page: return((parentComponent?.Context ?? AtataContext.Current).Driver); default: throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource)); } }
public StrategyScopeLocatorExecutionData Get(SearchOptions searchOptions) { searchOptions = searchOptions ?? new SearchOptions(); FindAttribute[] layerFindAttributes = _component.Metadata.ResolveLayerFindAttributes().ToArray(); FindAttribute findAttribute = _component.Metadata.ResolveFindAttribute(); var layerExecutionUnits = layerFindAttributes .Select(x => CreateExecutionUnitForLayerFindAttribute(x, searchOptions)) .ToArray(); var finalExecutionUnit = CreateExecutionUnitForFinalFindAttribute(findAttribute, searchOptions); ScopeSource scopeSource = layerFindAttributes.Any() && layerFindAttributes[0].Properties.Contains(nameof(FindAttribute.ScopeSource)) ? layerFindAttributes[0].ScopeSource : findAttribute.ScopeSource; PostProcessOuterXPath(layerExecutionUnits, finalExecutionUnit); return(new StrategyScopeLocatorExecutionData(_component, scopeSource, searchOptions.IsSafely, layerExecutionUnits, finalExecutionUnit)); }
public static ISearchContext GetScopeContext(this ScopeSource scopeSource, UIComponent component, SearchOptions options = null) { options = options ?? new SearchOptions(); switch (scopeSource) { case ScopeSource.Parent: return(component.Parent.GetScopeContext(options)); case ScopeSource.Grandparent: return(component.Parent.Parent.GetScopeContext(options)); case ScopeSource.PageObject: return(component.Owner.GetScopeContext(options)); case ScopeSource.Page: return(component.Driver); default: throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource)); } }
public List <InstructionIDNamePair> GetAllSubroutines(ScopeSource source) { var bhavs = GetAllResource <BHAV>(source); if (source == ScopeSource.SemiGlobal && Resource is GameGlobalResource) { bhavs = Resource.List <BHAV>(); } var output = new List <InstructionIDNamePair>(); if (bhavs == null) { return(output); } foreach (var bhav in bhavs) { output.Add(new InstructionIDNamePair(bhav.ChunkLabel, bhav.ChunkID)); } output = output.OrderBy(o => o.Name).ToList(); return(output); }
[Obsolete("Use GetScopeContext(...) instead.")] // Obsolete since v1.5.0. public static IWebElement GetScopeElement(this ScopeSource scopeSource, UIComponent component, SearchOptions options = null) { options = options ?? new SearchOptions(); switch (scopeSource) { case ScopeSource.Parent: return(component.Parent.GetScope(options)); case ScopeSource.Grandparent: return(component.Parent.Parent.GetScope(options)); case ScopeSource.PageObject: return(component.Owner.GetScope(options)); case ScopeSource.Page: return(component.Driver.GetWithLogging(By.TagName("body").With(options))); default: throw ExceptionFactory.CreateForUnsupportedEnumValue(scopeSource, nameof(scopeSource)); } }
protected virtual void Wait <TOwner>(IUIComponent <TOwner> scopeComponent, WaitUnit waitUnit) where TOwner : PageObject <TOwner> { ScopeSource actualScopeSource = scopeSource ?? scopeComponent.ScopeSource; StaleSafely.Execute( options => { ISearchContext scopeContext = actualScopeSource.GetScopeContext(scopeComponent, SearchOptions.Within(options.Timeout)); By by = WaitBy.GetBy(Selector).With(options); if (waitUnit.Method == WaitUnit.WaitMethod.Presence) { scopeContext.Exists(by); } else { scopeContext.Missing(by); } }, waitUnit.SearchOptions); }
public ReadOnlyCollection <IWebElement> GetAll(string xPathCondition = null) { return(ScopeSource.GetAll(CreateBy(xPathCondition))); }
public IWebElement Get(string xPathCondition = null) { return(ScopeSource.Get(CreateBy(xPathCondition))); }
[Obsolete("Use GetScopeContext(...) instead.")] // Obsolete since v1.5.0. public static IWebElement GetScopeElement <TOwner>(this ScopeSource scopeSource, IUIComponent <TOwner> component, SearchOptions options = null) where TOwner : PageObject <TOwner> { return(GetScopeElement(scopeSource, (UIComponent)component, options)); }
public static IWebElement GetScopeElement <TOwner>(this ScopeSource scopeSource, IUIComponent <TOwner> component) where TOwner : PageObject <TOwner> { return(GetScopeElement(scopeSource, (UIComponent)component)); }