fixes Puppeteer evaluateHandle parameters (#39020)

This commit is contained in:
angrykoala
2019-10-10 13:04:05 -07:00
committed by Armando Aguirre
parent 0a3c43f606
commit 83d8ffc9c6
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -7,6 +7,7 @@
// Serban Ghita <https://github.com/SerbanGhita>
// Jason Kaczmarsky <https://github.com/JasonKaz>
// Dave Cardwell <https://github.com/davecardwell>
// Andrés Ortiz <https://github.com/angrykoala>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -242,10 +243,10 @@ export interface JSEvalable<A = any> {
* @param args Arguments to pass to `fn`
*/
evaluateHandle(
pageFunction: (arg1: A, ...args: any[]) => any,
pageFunction: string | ((arg1: A, ...args: any[]) => any),
...args: SerializableOrJSHandle[],
): Promise<JSHandle>;
}
}
/** Keyboard provides an api for managing a virtual keyboard. */
export interface Keyboard {
+1
View File
@@ -309,6 +309,7 @@ puppeteer.launch().then(async browser => {
// evaluateHandle example
const aHandle = await page.evaluateHandle(() => document.body);
await page.evaluateHandle('document.body');
const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
console.log(await resultHandle.jsonValue());
await resultHandle.dispose();