RESTClient

Element Interaction via REST

Element interaction methods accept an element identifier - typically an XPath expression, CSS selector, or an opaque element ID returned by a prior query. LeftClick, LeftDoubleClick, MiddleClick, RightClick, and Hover simulate mouse interactions. FillInOverwrite, FillInAppend, and FillInInsert write text to inputs. SendString types a string. SendKey sends a virtual key code. Focus sets focus. GetAttribute and SetAttribute read and write DOM attributes. HideElement hides an element. WithPixels sets a pixel amount for the call that takes one, and WithDeviceName names the cast device to send the tab or desktop to.

Examples

GPAL Fluent: High-level fluent C# API

//Element identifiers in RESTClient are strings - either CSS selectors, XPath expressions, or element IDs returned by Evaluate/QuerySelector calls. Most methods that take an element identifier also have a FromResult variant that pulls the ID from a prior Execute result.

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

IRESTClient client = (IRESTClient)GPAL.RESTClient

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

.ToGPALObject();


// Click a button by CSS selector

client

.LeftClick("#submit-button")

.Execute();


// Fill an input by XPath

client

.FillInOverwrite("//input[@id='username']")

.WithText("admin")

.Execute();


// Get an attribute value

string href = client

.GetAttribute("#main-link")

.WithAttribute("href")

.Execute();

💬 Ask GPAL