Skip to main content
Version: 23.2.0

Keyboard.sendCharacter() 方法

¥Keyboard.sendCharacter() method

调度 keypressinput 事件。这不会发送 keydownkeyup 事件。

¥Dispatches a keypress and input event. This does not send a keydown or keyup event.

签名

¥Signature

class Keyboard {
abstract sendCharacter(char: string): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

char

string

要发送到页面的字符。

Returns:

Promise<void>

备注

¥Remarks

修改键不会影响 Keyboard.sendCharacter。按住 Shift 将不会键入大写文本。

¥Modifier keys DO NOT effect Keyboard.sendCharacter. Holding down Shift will not type the text in upper case.

示例

¥Example

page.keyboard.sendCharacter('嗨');