Interaction

Set Value From Element

Copy one element's value into another.

Copy one element's value into another.

Copies the current value of a source element into a destination element, then fires "input" and "change" events on the destination so the page reacts to the new value.

TIP

Source is always specified first, destination second. At the GPAL fluent (element) level this is reversed: WithSelector identifies the destination and SetValueFrom takes the source selector, matching the 'destination is the current element' convention used by SetAttribute and similar actions.

Examples

GPAL Fluent: High-level fluent C# API

//WithSelector identifies the destination element(s) whose value is set; SetValueFrom takes the source selector and completes the action.

browser.WithSelector(destSelector).SetValueFrom(srcSelector);

MagicHelper: MagicHelper utility library

//Source first, destination second.

GPAL.MagicHelper.SetValueFromElement(srcSelector, destSelector);

Puppeteer Client: Puppeteer-style C# client

//Same pattern as the REST client: WithElementId/WithCss identify the source, SetValueFrom(destSelector) names the destination.

browser.PuppeteerClient.WithElementId(srcSelector).SetValueFrom(destSelector).Execute(); browser.PuppeteerClient.WithCss(srcSelector).SetValueFrom(destSelector).Execute();

Puppeteer Communicator: Low-level communicator

//Evaluates document.querySelector for both selectors and sets destElement.value = srcElement.value, then dispatches input/change events on the destination.

await browser.PuppeteerCommunicator.SetValueFromElement(srcCss, destCss, sessionId);

REST Client: Direct REST/HTTP client

//WithElementId/WithCss identify the source element; SetValueFrom(destSelector) sets the endpoint, specifies the destination, and completes the action.

GPAL.OttoMagicClient.WithElementId(srcSelector).SetValueFrom(destSelector).Execute(); GPAL.OttoMagicClient.WithCss(srcSelector).SetValueFrom(destSelector).Execute();