Skip to content

Commit

Permalink
[dotnet] warn about upcoming changes to MoveToElementOffsetOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed May 27, 2022
1 parent 35bba6a commit cb68cf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
5 changes: 5 additions & 0 deletions dotnet/src/webdriver/Interactions/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ namespace OpenQA.Selenium.Interactions
/// <summary>
/// Provides values that indicate from where element offsets for MoveToElement
/// are calculated.
/// Note: TopLeft only does the expected thing when the element is completely
/// inside the viewport.
/// </summary>
[Obsolete("Starting in Selenium 4.3 only Center behavior will be supported")]
public enum MoveToElementOffsetOrigin
{
/// <summary>
Expand Down Expand Up @@ -308,6 +311,7 @@ public Actions MoveToElement(IWebElement toElement)

/// <summary>
/// Moves the mouse to the specified offset of the top-left corner of the specified element.
/// In Selenium 4.3 the origin for the offset will be the in-view center point of the 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>
Expand All @@ -326,6 +330,7 @@ public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY)
/// <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>
[Obsolete("Starting in Selenium 4.3 only MoveToElementOffsetOrigin.Center will be supported")]
public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
{
ILocatable target = GetLocatableFromElement(toElement);
Expand Down
18 changes: 4 additions & 14 deletions dotnet/src/webdriver/Interactions/PointerInputDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ public enum MouseButton
/// The X2 button used for navigating forward.
/// </summary>
Forward = 4,

/// <summary>
/// The button used by Pen pointers to erase.
/// </summary>
Eraser = 5
}

/// <summary>
Expand Down Expand Up @@ -177,7 +172,7 @@ public override Dictionary<string, object> ToDictionary()
/// <returns>The action representing the pointer down gesture.</returns>
public Interaction CreatePointerDown(MouseButton button)
{
return new PointerDownInteraction(this, button, new PointerEventProperties());
return CreatePointerDown(button, new PointerEventProperties());
}

/// <summary>
Expand All @@ -201,7 +196,7 @@ public Interaction CreatePointerDown(MouseButton button, PointerEventProperties
/// <returns>The action representing the pointer up gesture.</returns>
public Interaction CreatePointerUp(MouseButton button)
{
return new PointerUpInteraction(this, button, new PointerEventProperties());
return CreatePointerUp(button, new PointerEventProperties());
}

/// <summary>
Expand All @@ -228,7 +223,7 @@ public Interaction CreatePointerUp(MouseButton button, PointerEventProperties pr
/// <returns>The action representing the pointer move gesture.</returns>
public Interaction CreatePointerMove(IWebElement target, int xOffset, int yOffset, TimeSpan duration)
{
return new PointerMoveInteraction(this, target, CoordinateOrigin.Element, xOffset, yOffset, duration, new PointerEventProperties());
return CreatePointerMove(target, xOffset, yOffset, duration, new PointerEventProperties());
}

/// <summary>
Expand Down Expand Up @@ -258,12 +253,7 @@ public Interaction CreatePointerMove(IWebElement target, int xOffset, int yOffse
/// Users should us the other CreatePointerMove overload to move to a specific element.</exception>
public Interaction CreatePointerMove(CoordinateOrigin origin, int xOffset, int yOffset, TimeSpan duration)
{
if (origin == CoordinateOrigin.Element)
{
throw new ArgumentException("Using a value of CoordinateOrigin.Element without an element is not supported.", nameof(origin));
}

return new PointerMoveInteraction(this, null, origin, xOffset, yOffset, duration, new PointerEventProperties());
return CreatePointerMove(origin, xOffset, yOffset, duration, new PointerEventProperties());
}

/// <summary>
Expand Down

0 comments on commit cb68cf5

Please sign in to comment.