跳至主要内容
版本: 22.5.0

JSHandle.getProperties() 方法

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

签名:

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

返回值

Promise<Map<string, JSHandle>>

示例

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