Skip to main content

sdk.automation.clearandtype

Home > @matterway/sdk > Automation > clearAndType

Automation.clearAndType() function

Warning: This API is now obsolete.

  • Use fill instead.

Clears an input element and types the value into it.

Signature:

export declare function clearAndType(ctx: Context, selector: string, value: string): Promise<void>;

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringSelector for input element to clear and type.
valuestringValue to type into input element.

Returns:

Promise<void>

Remarks

Keep in mind that using the helper "clearAndType" 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 clearAndType(ctx, 'input[name="firstName"]', 'some value');