Ejemplo n.º 1
0
        /// <summary>
        /// Clicks the element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns><c>true</c> unless there is an error.</returns>
        public override bool ClickElement(HtmlControl element)
        {
            Point point;

            if (element.TryGetClickablePoint(out point))
            {
                element.EnsureClickable();
            }

            Mouse.Click(element);
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Clicks the element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <returns><c>true</c> unless there is an error.</returns>
        public override bool ClickElement(HtmlControl element)
        {
            this.WaitForElement(element, WaitConditions.NotMoving, timeout: null);

            Point point;

            if (element.TryGetClickablePoint(out point))
            {
                element.EnsureClickable();
            }

            Mouse.Click(element);
            return(true);
        }
Ejemplo n.º 3
0
        public static bool IsElementVisible(this HtmlControl control)
        {
            // Assume the control is invisible
            bool visible = false;

            System.Drawing.Point p;
            try
            {
                // If the control is offscreen, bring it into the viewport
                control.EnsureClickable();
                // Now check the coordinates of the clickable point
                visible = control.TryGetClickablePoint(out p) &&
                          (p.X > 0 || p.Y > 0);
            }
            catch (Exception ex)
            {
                // Boom goes the dynamite! Control is not visible.
                // Log to stdout for debugging.
                Console.WriteLine(ex);
            }
            return(visible);
        }