Interaction

Scroll Element

Scroll an element by a specified offset.

Scroll an element by a specified offset.

Scrolls a DOM element horizontally and vertically by the given pixel values using instant (non-animated) behavior, adjusting the elements internal scroll position relative to its current state.

Examples

GPAL Fluent: High-level fluent C# API

//ScrollElementHorizontalByPixels and ScrollElementVerticalByPixels use javascript injection to scroll the element matched by WithSelector by the given pixel amounts. Negative values scroll up/left.

browser .WithSelector("#scroll-container") .ScrollElementHorizontalByPixels(100) .ScrollElementVerticalByPixels(50);

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.ScrollElement(string css, int hPixels, int vPixels); GPAL.MagicHelper.ScrollElement(string xPath, int hPixels, int vPixels);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.ScrollElement(string css).WithHPixels(int hPixels).WithVPixels(int vPixels).Execute(); browser.PuppeteerClient.ScrollElement(string xpath).WithHPixels(int hPixels).WithVPixels(int vPixels).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.ScrollElement(string elementId, int hPixels, int vPixels, string sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.ScrollWindow).WithCss(string css).WithHPixels(int hPixels).WithVPixels(int vPixels).Execute(); GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.ScrollWindow).WithXPath(string xpath).WithHPixels(int hPixels).WithVPixels(int vPixels).Execute();