Skip to content

Commit cb68cf5

Browse files
committed
[dotnet] warn about upcoming changes to MoveToElementOffsetOrigin
1 parent 35bba6a commit cb68cf5

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

dotnet/src/webdriver/Interactions/Actions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ namespace OpenQA.Selenium.Interactions
2525
/// <summary>
2626
/// Provides values that indicate from where element offsets for MoveToElement
2727
/// are calculated.
28+
/// Note: TopLeft only does the expected thing when the element is completely
29+
/// inside the viewport.
2830
/// </summary>
31+
[Obsolete("Starting in Selenium 4.3 only Center behavior will be supported")]
2932
public enum MoveToElementOffsetOrigin
3033
{
3134
/// <summary>
@@ -308,6 +311,7 @@ public Actions MoveToElement(IWebElement toElement)
308311

309312
/// <summary>
310313
/// Moves the mouse to the specified offset of the top-left corner of the specified element.
314+
/// In Selenium 4.3 the origin for the offset will be the in-view center point of the element.
311315
/// </summary>
312316
/// <param name="toElement">The element to which to move the mouse.</param>
313317
/// <param name="offsetX">The horizontal offset to which to move the mouse.</param>
@@ -326,6 +330,7 @@ public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY)
326330
/// <param name="offsetY">The vertical offset to which to move the mouse.</param>
327331
/// <param name="offsetOrigin">The <see cref="MoveToElementOffsetOrigin"/> value from which to calculate the offset.</param>
328332
/// <returns>A self-reference to this <see cref="Actions"/>.</returns>
333+
[Obsolete("Starting in Selenium 4.3 only MoveToElementOffsetOrigin.Center will be supported")]
329334
public Actions MoveToElement(IWebElement toElement, int offsetX, int offsetY, MoveToElementOffsetOrigin offsetOrigin)
330335
{
331336
ILocatable target = GetLocatableFromElement(toElement);

dotnet/src/webdriver/Interactions/PointerInputDevice.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ public enum MouseButton
102102
/// The X2 button used for navigating forward.
103103
/// </summary>
104104
Forward = 4,
105-
106-
/// <summary>
107-
/// The button used by Pen pointers to erase.
108-
/// </summary>
109-
Eraser = 5
110105
}
111106

112107
/// <summary>
@@ -177,7 +172,7 @@ public override Dictionary<string, object> ToDictionary()
177172
/// <returns>The action representing the pointer down gesture.</returns>
178173
public Interaction CreatePointerDown(MouseButton button)
179174
{
180-
return new PointerDownInteraction(this, button, new PointerEventProperties());
175+
return CreatePointerDown(button, new PointerEventProperties());
181176
}
182177

183178
/// <summary>
@@ -201,7 +196,7 @@ public Interaction CreatePointerDown(MouseButton button, PointerEventProperties
201196
/// <returns>The action representing the pointer up gesture.</returns>
202197
public Interaction CreatePointerUp(MouseButton button)
203198
{
204-
return new PointerUpInteraction(this, button, new PointerEventProperties());
199+
return CreatePointerUp(button, new PointerEventProperties());
205200
}
206201

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

234229
/// <summary>
@@ -258,12 +253,7 @@ public Interaction CreatePointerMove(IWebElement target, int xOffset, int yOffse
258253
/// Users should us the other CreatePointerMove overload to move to a specific element.</exception>
259254
public Interaction CreatePointerMove(CoordinateOrigin origin, int xOffset, int yOffset, TimeSpan duration)
260255
{
261-
if (origin == CoordinateOrigin.Element)
262-
{
263-
throw new ArgumentException("Using a value of CoordinateOrigin.Element without an element is not supported.", nameof(origin));
264-
}
265-
266-
return new PointerMoveInteraction(this, null, origin, xOffset, yOffset, duration, new PointerEventProperties());
256+
return CreatePointerMove(origin, xOffset, yOffset, duration, new PointerEventProperties());
267257
}
268258

269259
/// <summary>

0 commit comments

Comments
 (0)