JSHandle.getProperties() 方法
取得代表目前 handle 屬性的 handle 對應表。
簽名
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