MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ScrollFromOrigin

Method ScrollFromOrigin

dotnet/src/webdriver/Interactions/Actions.cs:554–575  ·  view source on GitHub ↗

Scrolls by provided amount based on a provided origin. The scroll origin is either the center of an element or the upper left of the viewport plus any offsets. If the origin is an element, and the element is not in the viewport, the bottom of the element will first be scrolled to the bottom of the viewport. Where scroll originate

(WheelInputDevice.ScrollOrigin scrollOrigin, int deltaX, int deltaY)

Source from the content-addressed store, hash-verified

552 /// <exception cref="ArgumentNullException">If <paramref name="scrollOrigin"/> is null.</exception>
553 /// <exception cref="ArgumentException">If both or either of Viewport and Element are set.</exception>
554 public Actions ScrollFromOrigin(WheelInputDevice.ScrollOrigin scrollOrigin, int deltaX, int deltaY)
555 {
556 ArgumentNullException.ThrowIfNull(scrollOrigin);
557
558 if (scrollOrigin.Viewport && scrollOrigin.Element != null)
559 {
560 throw new ArgumentException("viewport can not be true if an element is defined.", nameof(scrollOrigin));
561 }
562
563 if (scrollOrigin.Viewport)
564 {
565 this.actionBuilder.AddAction(this.GetActiveWheel().CreateWheelScroll(CoordinateOrigin.Viewport,
566 scrollOrigin.XOffset, scrollOrigin.YOffset, deltaX, deltaY, duration));
567 }
568 else
569 {
570 this.actionBuilder.AddAction(this.GetActiveWheel().CreateWheelScroll(scrollOrigin.Element!,
571 scrollOrigin.XOffset, scrollOrigin.YOffset, deltaX, deltaY, duration));
572 }
573
574 return this;
575 }
576
577 /// <summary>
578 /// Performs a Pause.

Calls 4

GetActiveWheelMethod · 0.95
ThrowIfNullMethod · 0.80
CreateWheelScrollMethod · 0.80
AddActionMethod · 0.45