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); }