Skip to main content
Version: 23.8.0

JSHandle.getProperties() 方法

¥JSHandle.getProperties() method

获取表示当前句柄属性的句柄映射。

¥Gets a map of handles representing the properties of the current handle.

签名

¥Signature

class JSHandle {
getProperties(): Promise<Map<string, JSHandle>>;
}

Returns:

Promise<Map<string, JSHandle>>

示例

¥Example

const listHandle = await page.evaluateHandle(() => document.body.children);
const properties = await listHandle.getProperties();
const children = [];
for (const property of properties.values()) {
const element = property.asElement();
if (element) {
children.push(element);
}
}
children; // holds elementHandles to all children of document.body