|
| 1 | +--- |
| 2 | +title: 'dblclick([, options])' |
| 3 | +excerpt: 'Browser module: elementHandle.dblclick([, options]) method' |
| 4 | +--- |
| 5 | + |
| 6 | +# dblclick([, options]) |
| 7 | + |
| 8 | +Mouse double clicks the element. |
| 9 | + |
| 10 | +<TableWithNestedRows> |
| 11 | + |
| 12 | +| Parameter | Type | Default | Description | |
| 13 | +| ------------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 14 | +| options | object | `null` | | |
| 15 | +| options.button | string | `left` | The mouse button (`left`, `middle` or `right`) to use during the action. | |
| 16 | +| options.delay | number | `0` | Milliseconds to wait between `mousedown` and `mouseup`. | |
| 17 | +| options.force | boolean | `false` | Setting this to `true` will bypass the actionability checks (`visible`, `stable`, `enabled`). | |
| 18 | +| options.modifiers | string[] | `null` | `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action. If not specified, currently pressed modifiers are used. | |
| 19 | +| options.noWaitAfter | boolean | `false` | If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete. | |
| 20 | +| options.position | object | `null` | A point to use relative to the top left corner of the element. If not supplied, a visible point of the element is used. | |
| 21 | +| options.position.x | number | `0` | The x coordinate. | |
| 22 | +| options.position.y | number | `0` | The y coordinate. | |
| 23 | +| options.timeout | number | `30000` | Maximum time in milliseconds. Pass `0` to disable the timeout. Default is overridden by the `setDefaultTimeout` option on [BrowserContext](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/browsercontext/) or [Page](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/page/). | |
| 24 | +| options.trial | boolean | `false` | Setting this to `true` will perform the actionability checks without performing the action. | |
| 25 | + |
| 26 | +</TableWithNestedRows> |
| 27 | + |
| 28 | +### Example |
| 29 | + |
| 30 | +{{< code >}} |
| 31 | + |
| 32 | +```javascript |
| 33 | +import { browser } from 'k6/experimental/browser'; |
| 34 | + |
| 35 | +export const options = { |
| 36 | + scenarios: { |
| 37 | + browser: { |
| 38 | + executor: 'shared-iterations', |
| 39 | + options: { |
| 40 | + browser: { |
| 41 | + type: 'chromium', |
| 42 | + }, |
| 43 | + }, |
| 44 | + }, |
| 45 | + }, |
| 46 | +}; |
| 47 | + |
| 48 | +export default async function () { |
| 49 | + const page = browser.newPage(); |
| 50 | + |
| 51 | + await page.goto('https://test.k6.io/browser.php'); |
| 52 | + |
| 53 | + const elementHandle = page.$('#counter-button'); |
| 54 | + elementHandle.dblclick(); |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +{{< /code >}} |
0 commit comments