Skip to content

Function: setValue()

ts
function setValue(
   ctx: Context, 
   selector: string, 
   value: any, 
options?: WaitForSelectorOptions): Promise<void>;

Defined in: src/form/form.ts:107

Change the value of a form element.

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS selector for the target element.
valueanyNew value to assign.
options?WaitForSelectorOptionsOptional waiting parameters.

Returns

Promise<void>

Remarks

This helper does not trigger change events. The website will not detect the update. Use fill or type instead when the page needs to react to input.

Example

ts
// Set an order reference number on the checkout page
await setValue(ctx, '#order-reference', 'ORD-2026-88431');

Matterway Assistant SDK Documentation