RESTClient

DOM Queries and Context

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. GetSettings, GetGpalSettings and GetBrowserSettings read back what the extension and GPAL are configured with. GetWorkflow reads the workflow currently loaded. GetDocumentStamp answers a value that changes when the document does, GetHydrationScripts the scripts a framework used to hydrate the page, GetLanguages the languages the browser reports, and GetOptions the options of a select element.

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.

// the client object first, then the calls on it

IRESTClient client = (IRESTClient)GPAL.RESTClient

.WithAPIBase("http://localhost:9222")

.ToGPALObject();


// Query for an element by CSS

string elementId = client

.QuerySelector(".product-title")

.Execute();


// Get all attributes of an element

string attrs = client

.GetDomAttributes(elementId)

.Execute();


// AndThen hands the client back, so one call follows another on the same client

client

.QuerySelector("#payment-iframe")

.AndThen()

.LeftClick("#card-number")

.Execute();

💬 Ask GPAL