sdk.automation.clearandtypebyxpath
Home > @matterway/sdk > Automation > clearAndTypeByXpath
Automation.clearAndTypeByXpath() function
Warning: This API is now obsolete.
- Use
fillByXPath
instead.
Selects an input element by Xpath, clears and types into it.
Signature:
export declare function clearAndTypeByXpath(ctx: Context, selector: string, value: string): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
ctx | Context | Context object. |
selector | string | Selector for input field. |
value | string | Value to type into input field. |
Returns:
Promise<void>
Remarks
Keep in mind that using the helper "clearAndTypeByXpath" 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 "fillByXPath" or "typeByXPath" instead.
Example
await clearAndTypeByXpath(ctx, '//input[@id="firstName"]', 'John');