获取JSHANDLE句柄

A string can also be passed in instead of a function:

const aHandle = await page.evaluateHandle('document'); // Handle for the 'document'

JSHandle instances can be passed as arguments to the page.evaluateHandle:

const aHandle = await page.evaluateHandle(() => document.body);
const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
console.log(await resultHandle.jsonValue());
await resultHandle.dispose();
posted @ 2018-10-06 16:42  FromScratch  阅读(1371)  评论(0编辑  收藏  举报