Skip to main content

sdk.automation.fillbyxpath

Home > @matterway/sdk > Automation > fillByXPath

Automation.fillByXPath() function

Types the value into a form field by Xpath, replacing the existing text.

Signature:

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

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringXpath selector.
valuestringA text to type into field.

Returns:

Promise<void>

Remarks

Triggers an event for each character. If you want to keep the existing text, use the helper "typeByXPath".

Example

await fillByXPath(ctx, '//input[@id="message"]', 'Hello')