Skip to main content
Version: 23.2.0

Frame.focus() 方法

¥Frame.focus() method

聚焦与 selector 匹配的第一个元素。

¥Focuses the first element that matches the selector.

签名

¥Signature

class Frame {
focus(selector: string): Promise<void>;
}

参数

¥Parameters

范围

类型

描述

selector

string

要查询的选择器。

Returns:

Promise<void>

异常

¥Exceptions

如果没有元素匹配 selector,则抛出异常。

¥Throws if there's no element matching selector.