Ejemplo n.º 1
0
        /// <summary>
        ///     ...Description to be added...
        /// </summary>
        /// <param name="toElement">...Description to be added...</param>
        /// <param name="offsetX">...Description to be added...</param>
        /// <param name="offsetY">...Description to be added...</param>
        /// <param name="offsetOrigin">...Description to be added...</param>
        public ExtendedActions MoveToElement([NotNull] IWebElement toElement, int offsetX, int offsetY,
                                             MoveToElementOffsetOrigin offsetOrigin)
        {
            if (toElement == null)
            {
                throw new ArgumentNullException(nameof(toElement));
            }

            ChainedActions +=
                $"MoveToElement(toElement: {toElement}, offsetX: {offsetX}, offsetY: {offsetY}, offsetOrigin: {offsetOrigin}), ";
            Actions = Actions.MoveToElement(toElement, offsetX, offsetY, offsetOrigin);
            return(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Moves the mouse to the specified offset of the top-left corner of the specified element.
        /// </summary>
        /// <param name="toElement">The element to which to move the mouse.</param>
        /// <param name="offsetX">The horizontal offset to which to move the mouse.</param>
        /// <param name="offsetY">The vertical offset to which to move the mouse.</param>
        /// <param name="offsetOrigin">The <see cref="MoveToElementOffsetOrigin"/> value from which to calculate the offset.</param>
        /// <returns>A self-reference to this <see cref="Actions"/>.</returns>
        public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
        {
            ILocatable target          = GetLocatableFromElement(toElement);
            Size       elementSize     = toElement.Size;
            Point      elementLocation = toElement.Location;

            if (offsetOrigin == MoveToElementOffsetOrigin.TopLeft)
            {
                int modifiedOffsetX = offsetX - (elementSize.Width / 2);
                int modifiedOffsetY = offsetY - (elementSize.Height / 2);
                this.actionBuilder.AddAction(this.defaultMouse.CreatePointerMove(toElement, modifiedOffsetX, modifiedOffsetY, DefaultMouseMoveDuration));
            }
            else
            {
                int modifiedOffsetX = offsetX + (elementSize.Width / 2);
                int modifiedOffsetY = offsetY + (elementSize.Height / 2);
                this.actionBuilder.AddAction(this.defaultMouse.CreatePointerMove(toElement, offsetX, offsetY, DefaultMouseMoveDuration));
            }
            return(this);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Moves the mouse to the specified offset of the top-left corner of the specified element.
 /// </summary>
 /// <param name="sourceElement">The element to which to move the mouse.</param>
 /// <param name="offsetX">The horizontal offset to which to move the mouse.</param>
 /// <param name="offsetY">The vertical offset to which to move the mouse.</param>
 /// <param name="offsetOrigin">The <see cref="OpenQA.Selenium.Interactions.MoveToElementOffsetOrigin" /> value from which to calculate the offset.</param>
 /// <returns>A self-reference to this <see cref="Bellatrix.Web.InteractionsService" />.</returns>
 public InteractionsService MoveToElement(Element sourceElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
 {
     WrappedActions.MoveToElement(sourceElement.WrappedElement, offsetX, offsetY, offsetOrigin);
     return(this);
 }
Ejemplo n.º 4
0
 public IMouseActions MoveToElement(BaseElement toElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
 {
     actions.MoveToElement(toElement.IWebElement, offsetX, offsetY, offsetOrigin);
     return(this);
 }
Ejemplo n.º 5
0
 public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
 {
     return(Actions.MoveToElement(toElement, offsetX, offsetY, offsetOrigin));
 }
 public void MoveToElement(int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
 {
     LogAction("loc.mouse.movetoelement.byoffset.withorigin", offsetX, offsetY, offsetOrigin);
     PerformAction((actions, element) => actions.MoveToElement(element, offsetX, offsetY, offsetOrigin));
 }