> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browspark.krishm.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# devtools_evaluate

> Evaluate JavaScript in the page (or a specific frame/context, or the paused call frame) and return the value or the exception.

Evaluate JavaScript in the page (or a specific frame/context, or the paused call frame) and return the value or the exception. Objects come back as previews with an objectId for devtools\_console inspect. awaitPromise defaults to true.

## Parameters

<ParamField body="tabId" type="integer">
  Target tab id from browser\_tabs, which lists tabs across all windows. Defaults to the agent's most recently opened usable tab, or the only usable tab. Otherwise select a listed tabId.
</ParamField>

<ParamField body="expression" type="string" required>
   
</ParamField>

<ParamField body="contextId" type="integer">
  Execution context id from devtools\_sources frames
</ParamField>

<ParamField body="frameId" type="string">
  Frame id; picks its default context
</ParamField>

<ParamField body="callFrameId" type="string">
  Evaluate in a paused call frame (devtools\_debugger stack)
</ParamField>

<ParamField body="awaitPromise" type="boolean">
   
</ParamField>

<ParamField body="returnByValue" type="boolean">
  Default true; false keeps a live object handle
</ParamField>

<ParamField body="depth" type="integer">
  Range: 0 to 4.
</ParamField>

## Example

```json theme={null}
{
  "tabId": 1234,
  "expression": "document.title"
}
```

```json In the paused call frame theme={null}
{
  "tabId": 1234,
  "expression": "user.id",
  "callFrameId": "{\"ordinal\":0,\"injectedScriptId\":2}"
}
```
