Interaction

Scroll Into View

Scrolls the page so that the specified web element becomes visible and is positioned near the center of the viewport. GPAL utilizes a smart scroll; if the element is already visible on-screen (possibly due to another element scrolling into view) then no scrolling occurs until the element requested is not displayed.

Examples

GPAL Fluent: High-level fluent C# API

//A setting rather than a one-shot call: with it on, GPAL brings each element it is about to act on into view first, for the whole workflow. The layers below scroll one named element and are what this runs on.

browser.WithScrollIntoView(true);

MagicHelper: MagicHelper utility library

browser.MagicHelper.ScrollIntoView(string css);

browser.MagicHelper.ScrollIntoView(string xpath);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.ScrollIntoView(string css).Execute();

browser.PuppeteerClient.ScrollIntoView(string xpath).Execute();

Puppeteer Communicator: Low-level communicator

//PuppeteerCommunicator's ScrollIntoView takes a resolved backendNodeId (or GPALElement) rather than a raw CSS/XPath selector.

await browser.PuppeteerCommunicator.ScrollIntoView(int backendNodeId, string sessionId);

REST Client: Direct REST/HTTP client

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.ScrollIntoView).WithCss(string css).Execute();

browser.OttoMagicClient.WithEndpoint(ApiEndpoint.ScrollIntoView).WithXPath(string xpath).Execute();

💬 Ask GPAL