RESTClient

Element Interaction via REST

REST API methods for clicking, typing, hovering, and filling inputs on elements identified by XPath, CSS, or element ID.

REST API methods for clicking, typing, hovering, and filling inputs on elements identified by XPath, CSS, or element ID.

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.

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.

// Click a button by CSS selector GPAL.RestClient .WithAPIBase("http://localhost:9222") .LeftClick("#submit-button") .Execute(); // Fill an input by XPath GPAL.RestClient .WithAPIBase("http://localhost:9222") .FillInOverwrite("//input[@id='username']") .WithText("admin") .Execute(); // Get an attribute value string href = GPAL.RestClient .WithAPIBase("http://localhost:9222") .GetAttribute("#main-link") .WithAttribute("href") .Execute();