# noPlaywrightElementHandle

Rule `biome/noPlaywrightElementHandle`. Disallow usage of element handles (`page.$()` and `page.$$()`).

- Source: biome
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1918 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `style/noPlaywrightElementHandle` | no | unsafe | group style, since 2.4.2 | [docs](https://biomejs.dev/linter/rules/no-playwright-element-handle/) |

## Code examples

### Incorrect: the rule reports this

```js
const button = await page.$('button');
```

```js
const buttons = await page.$$('.btn');
```

```js
const element = await frame.$('#element');
```

### Correct: the rule accepts this

```js
const button = page.locator('button');
await button.click();
```

```js
const buttons = page.locator('.btn');
await expect(buttons).toHaveCount(3);
```

```js
await page.getByRole('button', { name: 'Submit' }).click();
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noPlaywrightElementHandle": "error"
      }
    }
  }
}
```

## Related rules

- [biome/noObsoleteTags](https://lintradar.dev/rules/biome/noObsoleteTags.md): Disallow obsolete HTML elements.
- [biome/noPlaywrightEval](https://lintradar.dev/rules/biome/noPlaywrightEval.md): Disallow usage of `page.$eval()` and `page.$$eval()`.
- [biome/noNonScalableViewport](https://lintradar.dev/rules/biome/noNonScalableViewport.md): Disallow disabling zoom with `user-scalable=no` in the `<meta name="viewport">` element.
- [biome/noPlaywrightForceOption](https://lintradar.dev/rules/biome/noPlaywrightForceOption.md): Disallow usage of the `{ force: true }` option.
- [biome/noNestedComponentDefinitions](https://lintradar.dev/rules/biome/noNestedComponentDefinitions.md): Disallows defining React components inside other components.
- [biome/noPlaywrightNetworkidle](https://lintradar.dev/rules/biome/noPlaywrightNetworkidle.md): Disallow usage of the `networkidle` option.

---

Web page: https://lintradar.dev/rules/biome/noPlaywrightElementHandle. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
