---
title: "innerText() | Grafana k6 documentation"
description: "Browser module: elementHandle.innerText method"
---

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

# innerText()

> Warning
> 
> Use [`locator.innerText([options])`](/docs/k6/latest/javascript-api/k6-browser/locator/innertext/) instead.

Returns the element’s inner text.

### Returns

Expand table

| Type              | Description                                                 |
|-------------------|-------------------------------------------------------------|
| `Promise<string>` | A Promise that fulfills with the inner text of the element. |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import { browser } from 'k6/browser';

export const options = {
  scenarios: {
    browser: {
      executor: 'shared-iterations',
      options: {
        browser: {
          type: 'chromium',
        },
      },
    },
  },
};

export default async function () {
  const page = await browser.newPage();
  await page.goto('https://test.k6.io/browser.php');

  const offScreen = await page.$('#off-screen');
  console.log(await offScreen.innerText()); // Off page div

  await page.close();
}
```
