TestAutomationEssentials.Selenium.ElementsContainer.WaitForElement C# (CSharp) Méthode

WaitForElement() public méthode

public WaitForElement ( By by, string description, int seconds = DefaultWaitTimeout ) : BrowserElement
by OpenQA.Selenium.By
description string
seconds int
Résultat BrowserElement
        public BrowserElement WaitForElement(By by, string description, int seconds = DefaultWaitTimeout)
        {
            Activate();

            var searchContext = GetSearchContext();
            try
            {
                Wait.Until(() => searchContext.FindElements(@by).FirstOrDefault(BrowserElement.IsAvailable),
                    el => el != null,
                    seconds.Seconds(),
                    "Element '{0}' not found inside '{1}' using '{2}' for '{3}' seconds", description, Description, @by, seconds);

                return new BrowserElement(this, @by, elements => elements.FirstOrDefault(BrowserElement.IsAvailable), description);
            }
            catch (StaleElementReferenceException)
            {
                throw new StaleElementReferenceException(
                    string.Format("The element '{0}' is no longer available on inside '{1}' using '{2}'", description, Description, @by));
            }
        }