Appearance
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
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS selector for the target element. |
value | any | New value to assign. |
options? | WaitForSelectorOptions | Optional 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');