Skip to main content

sdk.automation.setvalue

Home > @matterway/sdk > Automation > setValue

Automation.setValue() function

Changes the value of a form element.

Signature:

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

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringElement selector.
valueanyNew value.
optionsWaitForSelectorOptions(Optional)

Returns:

Promise<void>

Remarks

Keep in mind that using the helper "setValue" on form fields will not trigger change events, and the website will not see the change. In this case, one almost always want to use "fill" or "type" instead.

Example

await setValue(ctx, '#id-number', '23d79d99S');