Interaction

Is Visible In Viewport

Check if element is fully visible in viewport.

Check if element is fully visible in viewport.

Determines whether the element is completely within the visible browser viewport by comparing its bounding rectangle to the windows width and height, and returns a boolean result.

Examples

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.IsVisibleInViewport(string css); GPAL.MagicHelper.IsVisibleInViewport(string xpath);

Puppeteer Client: Puppeteer-style C# client

//PuppeteerClient.IsVisibleInViewport takes a resolved backendNodeId (or GPALElement), not a raw CSS/XPath selector.

browser.PuppeteerClient.IsVisibleInViewport(string backendNodeId).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.IsVisibleInViewport(dynamic elemsOrBackendNodeId, string sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.IsVisibleInViewport).WithCss(string css).Execute(); GPAL.OttoMagicClient.WithEndpoint(ApiEndpoint.IsVisibleInViewport).WithXPath(string xpath).Execute();