Skip to main content
Version: 22.9.0

Frame.$()方法

¥Frame.$() method

查询框架中与给定选择器匹配的元素。

¥Queries the frame for an element matching the given selector.

签名:

¥Signature:

class Frame {
$<Selector extends string>(
selector: Selector
): Promise<ElementHandle<NodeFor<Selector>> | null>;
}

参数

¥Parameters

范围

类型

描述

selector

选择器

要查询的选择器。

Returns:

Promise<ElementHandle<NodeFor<Selector>> | null>

元素句柄 到与给定选择器匹配的第一个元素。否则,null

¥A element handle to the first element matching the given selector. Otherwise, null.