Skip to content

Variable: typeByXPath()

ts
const typeByXPath: (ctx: Context, selector: string, value: string, options: TypeOptions & WaitForSelectorOptions) => Promise<void> = type;

Defined in: src/keyboard/index.ts:259

Type text into a form field after existing content.

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS selector.
valuestringText to type into the field.
optionsTypeOptions & WaitForSelectorOptionsTyping behavior and wait options.

Returns

Promise<void>

Remarks

Fire an event for each character. To clear the field first, use fill.

Examples

ts
// Type a message in a chat box
await type(ctx, '#chat-input', 'Hey, are we still on for Friday?');
ts
// Type slowly into a search field and blur when done
await type(ctx, '#search', 'vintage guitars', {
  delay: 80,
  clear: true,
  blur: true,
});

Deprecated

Use type instead.

Type text into a form field by XPath.

Param

Context object.

Param

XPath selector.

Param

Text to type into the field.

Param

Typing behavior and wait options.

Matterway Assistant SDK Documentation