Skip to main content
Version: 24.38.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

范围

🌐 Parameter

类型

🌐 Type

描述

🌐 Description

char

string

要发送到页面的字符。

🌐 Character to send into the page.

返回:

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('嗨');