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

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

# $$(selector)

Queries the elements for the given selector in the [ElementHandle](/docs/k6/latest/javascript-api/k6-browser/elementhandle/)’s subtree. The results are returned in DOM order.

Expand table

| Parameter | Type     | Default | Description                           |
|-----------|----------|---------|---------------------------------------|
| selector  | `string` |         | A selector to query the elements for. |

### Returns

Expand table

| Type                              | Description                                                                                                                                                                                     |
|-----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Promise<null | ElementHandle[]>` | A Promise that fulfills with an [ElementHandle](/docs/k6/latest/javascript-api/k6-browser/elementhandle/) array for the elements found. If no element is found, the Promise resolves to `null`. |

### 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 elements = await page.$$('#text1');
  for (const element of elements) {
    // ...
  }

  await page.close();
}
```
