---
title: "evaluateHandle(pageFunction[, arg]) | Grafana k6 documentation"
description: "Browser module: frame.evaluateHandle(pageFunction[, arg]) method"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# evaluateHandle(pageFunction\[, arg])

Executes JavaScript code in the page and returns the value of the `pageFunction` invocation as a [JSHandle](/docs/k6/latest/javascript-api/k6-browser/jshandle/).

The only difference between `page.evaluate()` and `page.evaluateHandle()` is that `page.evaluateHandle()` returns [JSHandle](/docs/k6/latest/javascript-api/k6-browser/jshandle/).

Expand table

| Parameter    | Type               | Defaults | Description                                                              |
|--------------|--------------------|----------|--------------------------------------------------------------------------|
| pageFunction | function or string |          | Function to be evaluated in the page context. This can also be a string. |
| arg          | string             | `''`     | Optional argument to pass to `pageFunction`                              |

### Returns

Expand table

| Type                | Description                                                                                             |
|---------------------|---------------------------------------------------------------------------------------------------------|
| `Promise<JSHandle>` | The [JSHandle](/docs/k6/latest/javascript-api/k6-browser/jshandle/) instance associated with the frame. |
