2020-06-04 14:56:45 +00:00
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home ](./index.md ) > [puppeteer ](./puppeteer.md ) > [ExecutionContext ](./puppeteer.executioncontext.md ) > [evaluateHandle ](./puppeteer.executioncontext.evaluatehandle.md )
## ExecutionContext.evaluateHandle() method
< b > Signature:< / b >
```typescript
2020-07-01 11:44:08 +00:00
evaluateHandle< HandleType extends JSHandle | ElementHandle = JSHandle > (pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise< HandleType > ;
2020-06-04 14:56:45 +00:00
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
2020-07-01 11:44:08 +00:00
| pageFunction | [EvaluateHandleFn ](./puppeteer.evaluatehandlefn.md ) | a function to be evaluated in the < code > executionContext</ code > |
| args | [SerializableOrJSHandle ](./puppeteer.serializableorjshandle.md )<!-- --> \[\] | argument to pass to the page function |
2020-06-04 14:56:45 +00:00
< b > Returns:< / b >
2020-07-01 11:44:08 +00:00
Promise< HandleType>
2020-06-04 14:56:45 +00:00
2020-06-24 15:11:10 +00:00
A promise that resolves to the return value of the given function as an in-page object (a [JSHandle ](./puppeteer.jshandle.md )<!-- --> ).
## Remarks
The only difference between `executionContext.evaluate` and `executionContext.evaluateHandle` is that `executionContext.evaluateHandle` returns an in-page object (a [JSHandle ](./puppeteer.jshandle.md )<!-- --> ). If the function passed to the `executionContext.evaluateHandle` returns a Promise, then `executionContext.evaluateHandle` would wait for the promise to resolve and return its value.
## Example 1
```js
const context = await page.mainFrame().executionContext();
const aHandle = await context.evaluateHandle(() => Promise.resolve(self));
aHandle; // Handle for the global object.
```
## Example 2
A string can also be passed in instead of a function.
```js
// Handle for the '3' * object.
const aHandle = await context.evaluateHandle('1 + 2');
```
## Example 3
JSHandle instances can be passed as arguments to the `executionContext.* evaluateHandle` <!-- --> :
```js
const aHandle = await context.evaluateHandle(() => document.body);
const resultHandle = await context.evaluateHandle(body => body.innerHTML, * aHandle);
console.log(await resultHandle.jsonValue()); // prints body's innerHTML
await aHandle.dispose();
await resultHandle.dispose();
```