---
title: "Mouse | Grafana k6 documentation"
description: "Browser module: Mouse Class"
---

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

# Mouse

`Mouse` provides a way to interact with a virtual mouse.

Expand table

| Method                                                                                   | Description                                                     |
|------------------------------------------------------------------------------------------|-----------------------------------------------------------------|
| [click(x, y\[, options\])](/docs/k6/latest/javascript-api/k6-browser/mouse/click/)       | Mouse clicks on the `x` and `y` coordinates.                    |
| [dblclick(x, y\[, options\])](/docs/k6/latest/javascript-api/k6-browser/mouse/dblclick/) | Mouse double clicks on the `x` and `y` coordinates.             |
| [down(\[options\])](/docs/k6/latest/javascript-api/k6-browser/mouse/down/)               | Dispatches a `mousedown` event on the mouse’s current position. |
| [up(\[options\])](/docs/k6/latest/javascript-api/k6-browser/mouse/up/)                   | Dispatches a `mouseup` event on the mouse’s current position.   |
| [move(x, y\[, options\])](/docs/k6/latest/javascript-api/k6-browser/mouse/move/)         | Dispatches a `mousemove` event on the mouse’s current position. |

### 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: {
    ui: {
      executor: 'shared-iterations',
      options: {
        browser: {
            type: 'chromium',
        },
      },
    },
  }
}

export default async function () {
  const page = await browser.newPage();

  await page.goto('https://test.k6.io/', {
    waitUntil: 'networkidle'
});

  // Obtain ElementHandle for news link and navigate to it
  // by clicking in the 'a' element's bounding box
  const newsLinkBox = await page.$('a[href="/news.php"]');
  const boundingBox = await newsLinkBox.boundingBox();
  const x = newsLinkBox.x + newsLinkBox.width / 2; // center of the box
  const y = newsLinkBox.y;

  await page.mouse.click(x, y);

  await page.close();
}
```
