RESTClient

DOM Queries and Context

REST API methods for querying the DOM by XPath or CSS, retrieving element properties, and switching context to iframes and shadow DOM.

REST API methods for querying the DOM by XPath or CSS, retrieving element properties, and switching context to iframes and shadow DOM.

Evaluate and EvaluateAll run XPath expressions against the document. QuerySelector and QuerySelectors use CSS selectors. The Persistent variants add a query that re-runs automatically. GetDomAttributes, GetDomProperties, GetCssAttributes, and GetContentAndCss retrieve full attribute/style information for an element. GetBoundingClientRect returns position and size. InElement switches context to an element for scoped queries. InShadowDom switches into a shadow DOM subtree. InMainDom returns to the main document.

Examples

GPAL Fluent: High-level fluent C# API

//Evaluate and QuerySelector return an element ID string that can be passed to subsequent interaction calls. Use WithElementIdFromResult to chain without storing intermediate values.

// Query for an element by CSS string elementId = GPAL.RestClient .WithAPIBase("http://localhost:9222") .QuerySelector(".product-title") .Execute(); // Get all attributes of an element string attrs = GPAL.RestClient .WithAPIBase("http://localhost:9222") .GetDomAttributes(elementId) .Execute(); // Work inside an iframe GPAL.RestClient .WithAPIBase("http://localhost:9222") .InElement("#payment-iframe") .LeftClick("#card-number") .Execute();