Exemple #1
0
        /// <summary>
        /// Wait for the element to be visible and scrolls into view
        /// </summary>
        /// <param name="by">'by' selector for the element</param>
        /// <returns>The web element</returns>
        /// <example>
        /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="WaitForAndScroll" lang="C#" />
        /// <code source = "../SeleniumUnitTesting/SeleniumWebElementTest.cs" region="WaitForAndScroll" lang="C#" />
        /// </example>
        public IWebElement ForClickableElementAndScrollIntoView(By by)
        {
            IWebElement element = this.ForClickableElement(by);

            ElementHandler.ScrollIntoView(this.searchItem, by);
            return(element);
        }
Exemple #2
0
        /// <summary>
        /// Waits for the element to be visible and scrolls into view
        /// </summary>
        /// <param name="by">'by' selector for the element</param>
        /// <param name="x">Horizontal offset</param>
        /// <param name="y">Vertical offset</param>
        /// <returns>True if the element is visible and scrolled into view</returns>
        /// <example>
        /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="WaitUntilClickableAndScrollWithOffset" lang="C#" />
        /// <code source = "../SeleniumUnitTesting/SeleniumWebElementTest.cs" region="WaitUntilClickableAndScrollWithOffset" lang="C#" />
        /// </example>
        public bool UntilClickableElementAndScrollIntoView(By by, int x, int y)
        {
            if (this.UntilClickableElement(by))
            {
                ElementHandler.ScrollIntoView(this.searchItem, by, x, y);
                return(true);
            }

            return(false);
        }
Exemple #3
0
        /// <summary>
        /// Attempts to wait for the element to be visible and scrolls into view
        /// </summary>
        /// <param name="by">'by' selector for the element</param>
        /// <param name="x">Horizontal offset</param>
        /// <param name="y">Vertical offset</param>
        /// <param name="element">When this method returns, IWebElement containing the element if it is clickable, else null</param>
        /// <returns>True if the element is clickable</returns>
        /// <example>
        /// <code source = "../SeleniumUnitTesting/SeleniumUnitTest.cs" region="TryWaitForAndScroll" lang="C#" />
        /// </example>
        public bool TryForClickableElementAndScrollIntoView(By by, int x, int y, out IWebElement element)
        {
            bool result = this.TryForClickableElement(by, out element);

            if (result)
            {
                ElementHandler.ScrollIntoView(this.searchItem, by, x, y);
            }

            return(result);
        }