{
  "doc": {
    "id": "api/commands/click",
    "title": "cy.click()",
    "description": "Click a DOM element in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/click.md",
    "version": "c4ad6f88c531de58221c73dd91a75af7138334b8",
    "updated_at": "2026-11-10T01:15:02.829Z",
    "headings": [
      {
        "id": "api/commands/click#click",
        "text": "click",
        "level": 1
      },
      {
        "id": "api/commands/click#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/click#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/click#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/click#yields",
        "text": "Yields",
        "level": 3
      },
      {
        "id": "api/commands/click#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/click#no-args",
        "text": "No Args",
        "level": 3
      },
      {
        "id": "api/commands/click#click-a-link-in-a-nav",
        "text": "Click a link in a nav",
        "level": 4
      },
      {
        "id": "api/commands/click#assert-on-the-result-of-a-click",
        "text": "Assert on the result of a click",
        "level": 4
      },
      {
        "id": "api/commands/click#wait-for-the-request-a-click-sends",
        "text": "Wait for the request a click sends",
        "level": 4
      },
      {
        "id": "api/commands/click#click-a-button-that-starts-out-disabled",
        "text": "Click a button that starts out disabled",
        "level": 4
      },
      {
        "id": "api/commands/click#click-one-element-out-of-several-matches",
        "text": "Click one element out of several matches",
        "level": 4
      },
      {
        "id": "api/commands/click#dismiss-what-covers-an-element-before-clicking-it",
        "text": "Dismiss what covers an element before clicking it",
        "level": 4
      },
      {
        "id": "api/commands/click#position",
        "text": "Position",
        "level": 3
      },
      {
        "id": "api/commands/click#specify-a-corner-of-the-element-to-click",
        "text": "Specify a corner of the element to click",
        "level": 4
      },
      {
        "id": "api/commands/click#click-outside-an-element-to-dismiss-it",
        "text": "Click outside an element to dismiss it",
        "level": 4
      },
      {
        "id": "api/commands/click#coordinates",
        "text": "Coordinates",
        "level": 3
      },
      {
        "id": "api/commands/click#specify-explicit-coordinates-relative-to-the-top-left-corner",
        "text": "Specify explicit coordinates relative to the top left corner",
        "level": 4
      },
      {
        "id": "api/commands/click#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "api/commands/click#control-where-cypress-scrolls-the-element-before-clicking",
        "text": "Control where Cypress scrolls the element before clicking",
        "level": 4
      },
      {
        "id": "api/commands/click#force-a-click-regardless-of-its-actionable-state",
        "text": "Force a click regardless of its actionable state",
        "level": 4
      },
      {
        "id": "api/commands/click#force-a-click-with-position-argument",
        "text": "Force a click with position argument",
        "level": 4
      },
      {
        "id": "api/commands/click#force-a-click-with-relative-coordinates",
        "text": "Force a click with relative coordinates",
        "level": 4
      },
      {
        "id": "api/commands/click#click-every-element-that-matches-a-selector",
        "text": "Click every element that matches a selector",
        "level": 4
      },
      {
        "id": "api/commands/click#click-with-key-combinations",
        "text": "Click with key combinations",
        "level": 4
      },
      {
        "id": "api/commands/click#shift-click",
        "text": "Shift click",
        "level": 4
      },
      {
        "id": "api/commands/click#ctrl-or-cmd-click-to-select-several-items",
        "text": "Ctrl or Cmd click to select several items",
        "level": 4
      },
      {
        "id": "api/commands/click#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/click#actionability",
        "text": "Actionability",
        "level": 3
      },
      {
        "id": "api/commands/click#the-element-must-first-reach-actionability",
        "text": "The element must first reach actionability",
        "level": 4
      },
      {
        "id": "api/commands/click#focus",
        "text": "Focus",
        "level": 3
      },
      {
        "id": "api/commands/click#focus-is-given-to-the-first-focusable-element",
        "text": "Focus is given to the first focusable element",
        "level": 4
      },
      {
        "id": "api/commands/click#cancellation",
        "text": "Cancellation",
        "level": 3
      },
      {
        "id": "api/commands/click#pointerdown-or-mousedown-cancellation-prevents-focus",
        "text": "Pointerdown or mousedown cancellation prevents focus",
        "level": 4
      },
      {
        "id": "api/commands/click#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/click#requirements",
        "text": "Requirements",
        "level": 3
      },
      {
        "id": "api/commands/click#assertions",
        "text": "Assertions",
        "level": 3
      },
      {
        "id": "api/commands/click#timeouts",
        "text": "Timeouts",
        "level": 3
      },
      {
        "id": "api/commands/click#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/click#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/commands/click#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/click#syntax",
      "doc_id": "api/commands/click",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.click()\n.click(options)\n.click(position)\n.click(position, options)\n.click(x, y)\n.click(x, y, options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.get('[data-cy=submit]').click() // Click on button\ncy.focused().click() // Click on el with focus\ncy.contains('Welcome').click() // Click on first el containing 'Welcome'\n```\n\n**Incorrect Usage**\n\n```\ncy.click('[data-cy=submit]') // Errors, cannot be chained off 'cy'\ncy.window().click() // Errors, 'window' does not yield DOM element\n```\n\n### Arguments\n\n**position _(String)_**\n\nThe position where the click should be issued. The `center` position is the default position. Valid positions are `topLeft`, `top`, `topRight`, `left`, `center`, `right`, `bottomLeft`, `bottom`, and `bottomRight`.\n\n**x _(Number)_**\n\nThe distance in pixels from the element's left to issue the click.\n\n**y _(Number)_**\n\nThe distance in pixels from the element's top to issue the click.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.click()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `altKey` | `false` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |\n| `animationDistanceThreshold` | [`animationDistanceThreshold`](/llm/markdown/app/references/configuration.md#Actionability) | The distance in pixels an element must exceed over time to be [considered animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations). |\n| `ctrlKey` | `false` | Activates the control key. Aliases: `controlKey`. |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `force` | `false` | Forces the action, disables [waiting for actionability](#Assertions) |\n| `metaKey` | `false` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |\n| `multiple` | `false` | Serially click multiple elements |\n| `scrollBehavior` | [`scrollBehavior`](/llm/markdown/app/references/configuration.md#Actionability) | Viewport position to where an element [should be scrolled](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) before executing the command. Accepts a single alignment, a per-axis `{ block, inline }` object, or `false`. |\n| `shiftKey` | `false` | Activates the shift key. |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.click()` to resolve before [timing out](#Timeouts) |\n| `waitForAnimations` | [`waitForAnimations`](/llm/markdown/app/references/configuration.md#Actionability) | Whether to wait for elements to [finish animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations) before executing the command. |\n\n### Yields\n\n*   `.click()` yields the same subject it was given.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the subject after `.click()`.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 473
    },
    {
      "id": "api/commands/click#usage",
      "doc_id": "api/commands/click",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.get('[data-cy=submit]').click() // Click on button\ncy.focused().click() // Click on el with focus\ncy.contains('Welcome').click() // Click on first el containing 'Welcome'\n```\n\n**Incorrect Usage**\n\n```\ncy.click('[data-cy=submit]') // Errors, cannot be chained off 'cy'\ncy.window().click() // Errors, 'window' does not yield DOM element\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 63
    },
    {
      "id": "api/commands/click#arguments",
      "doc_id": "api/commands/click",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**position _(String)_**\n\nThe position where the click should be issued. The `center` position is the default position. Valid positions are `topLeft`, `top`, `topRight`, `left`, `center`, `right`, `bottomLeft`, `bottom`, and `bottomRight`.\n\n**x _(Number)_**\n\nThe distance in pixels from the element's left to issue the click.\n\n**y _(Number)_**\n\nThe distance in pixels from the element's top to issue the click.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.click()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `altKey` | `false` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |\n| `animationDistanceThreshold` | [`animationDistanceThreshold`](/llm/markdown/app/references/configuration.md#Actionability) | The distance in pixels an element must exceed over time to be [considered animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations). |\n| `ctrlKey` | `false` | Activates the control key. Aliases: `controlKey`. |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `force` | `false` | Forces the action, disables [waiting for actionability](#Assertions) |\n| `metaKey` | `false` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |\n| `multiple` | `false` | Serially click multiple elements |\n| `scrollBehavior` | [`scrollBehavior`](/llm/markdown/app/references/configuration.md#Actionability) | Viewport position to where an element [should be scrolled](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) before executing the command. Accepts a single alignment, a per-axis `{ block, inline }` object, or `false`. |\n| `shiftKey` | `false` | Activates the shift key. |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.click()` to resolve before [timing out](#Timeouts) |\n| `waitForAnimations` | [`waitForAnimations`](/llm/markdown/app/references/configuration.md#Actionability) | Whether to wait for elements to [finish animating](/llm/markdown/app/core-concepts/interacting-with-elements.md#Animations) before executing the command. |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 357
    },
    {
      "id": "api/commands/click#examples",
      "doc_id": "api/commands/click",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### No Args\n\n#### Click a link in a nav\n\n```\ncy.get('[data-cy=nav] a').click()\n```\n\n#### Assert on the result of a click\n\nChaining further commands off the subject of `.click()` is unsafe, since the click can re-render or remove the element. Start a new chain from `cy` and assert on what the click changed.\n\n```\ncy.get('[data-cy=open-modal]').click()\ncy.get('[data-cy=modal]').should('be.visible')\n```\n\n#### Wait for the request a click sends\n\nRegister a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) before the click, then [`cy.wait()`](/llm/markdown/api/commands/wait.md) on its alias so the test continues only after the request completes.\n\n```\ncy.intercept('POST', '/api/todos').as('createTodo')\ncy.get('[data-cy=save]').click()\ncy.wait('@createTodo').its('response.statusCode').should('eq', 201)\n```\n\n#### Click a button that starts out disabled\n\n`.click()` retries its [actionability checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Disability), including the check that the element is not disabled, until the command times out. You don't need to assert that the button is enabled before clicking it.\n\nThis check reads the element's `disabled` property. A button marked only with `aria-disabled=\"true\"` is not disabled to Cypress, so `.click()` fires on it right away. For those buttons, assert on the attribute before clicking.\n\n```\ncy.get('[data-cy=email]').type('user@example.com')\n// waits until the submit button is no longer disabled\ncy.get('[data-cy=submit]').click()\n\n// a button disabled with aria-disabled instead\ncy.get('[data-cy=next]').should('not.have.attr', 'aria-disabled', 'true')\ncy.get('[data-cy=next]').click()\n```\n\n#### Click one element out of several matches\n\nWhen a query matches more than one element, narrow it to the one you want instead of passing `{ multiple: true }`. Use [`.first()`](/llm/markdown/api/commands/first.md), [`.eq()`](/llm/markdown/api/commands/eq.md), or [`cy.contains()`](/llm/markdown/api/commands/contains.md) with a selector and text.\n\n```\ncy.get('[data-cy=todo] [data-cy=delete]').first().click()\ncy.get('[data-cy=todo]').eq(2).find('[data-cy=delete]').click()\ncy.contains('button', 'Submit').click()\n```\n\n#### Dismiss what covers an element before clicking it\n\nWhen another element covers the one you want to click, deal with it the way a user would before reaching for [`{ force: true }`](#Force-a-click-regardless-of-its-actionable-state). Forcing skips the checks that would catch a real bug, such as a banner that blocks users from checking out.\n\n```\ncy.get('[data-cy=cookie-banner] [data-cy=accept]').click()\ncy.get('[data-cy=checkout]').click()\n```\n\n### Position\n\n#### Specify a corner of the element to click\n\nClick the top right corner of the button.\n\n```\ncy.get('[data-cy=submit]').click('topRight')\n```\n\n#### Click outside an element to dismiss it\n\nClose a dropdown or popover the way a user would, by clicking an empty area of the page. Cypress clicks whatever element is at the position you choose, so target an element and position that are empty in your app. Avoid the top left corner of `body`, which in many layouts holds a logo or navigation link that navigates away.\n\n```\ncy.get('[data-cy=menu-toggle]').click()\ncy.get('[data-cy=main-content]').click('topRight')\ncy.get('[data-cy=menu]').should('not.exist')\n```\n\n### Coordinates\n\n#### Specify explicit coordinates relative to the top left corner\n\nThe click below is issued inside of the element (15px from the left and 40px from the top).\n\n```\ncy.get('[data-cy=top-banner]').click(15, 40)\n```\n\n### Options\n\n#### Control where Cypress scrolls the element before clicking\n\nCypress scrolls the element into view before clicking it, aligning it to the top of its scrollable container by default. If a `position: fixed` or `position: sticky` element such as a header then covers it, Cypress [scrolls past the covering element](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) until the element is clear.\n\nWhen that isn't enough, or when you want the element in a predictable spot, pass `scrollBehavior`. Center the element in the viewport, or set each axis separately with a `{ block, inline }` object.\n\n```\ncy.get('[data-cy=row-42] button').click({ scrollBehavior: 'center' })\ncy.get('[data-cy=carousel-item]').click({\n  scrollBehavior: { block: 'center', inline: 'nearest' },\n})\n```\n\n#### Force a click regardless of its actionable state\n\nForcing a click overrides the [actionable checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Forcing) Cypress applies and fires the events.\n\n```\ncy.get('[data-cy=close]').as('closeBtn')\ncy.get('@closeBtn').click({ force: true })\n```\n\n#### Force a click with position argument\n\n```\ncy.get('[data-cy=collapse-sidebar]').click('bottomLeft', { force: true })\n```\n\n#### Force a click with relative coordinates\n\n```\ncy.get('[data-cy=footer] [data-cy=next]').click(5, 60, { force: true })\n```\n\n#### Click every element that matches a selector\n\nBy default, Cypress errors if you try to click multiple elements. When you pass `{ multiple: true }`, Cypress clicks each element in turn, gives each click its own full timeout, and logs each click to the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log).\n\n```\ncy.get('[data-cy=expand-section]').click({ multiple: true })\n```\n\n#### Click with key combinations\n\nThe `.click()` command may also be fired with key modifiers to simulate holding key combinations while clicking, such as `ALT + click`.\n\nYou can also use key combinations during [.type()](/llm/markdown/api/commands/type.md). This offers options to hold down keys across multiple commands. See [Key Combinations](/llm/markdown/api/commands/type.md#Key-Combinations) for more information.\n\nThe following keys can be combined with `.click()` through the `options`.\n\n| Option | Notes |\n| --- | --- |\n| `altKey` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |\n| `ctrlKey` | Activates the control key. Aliases: `controlKey`. |\n| `metaKey` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |\n| `shiftKey` | Activates the shift key. |\n\n#### Shift click\n\n```\n// execute a SHIFT + click on the first file\ncy.get('[data-cy=file]').first().click({\n  shiftKey: true,\n})\n```\n\n#### Ctrl or Cmd click to select several items\n\nMany apps check the control key on Windows and Linux and the command key on macOS. Use [`Cypress.platform`](/llm/markdown/api/cypress-api/platform.md) to hold the key the app expects.\n\n```\nconst modifier =\n  Cypress.platform === 'darwin' ? { metaKey: true } : { ctrlKey: true }\n\ncy.get('[data-cy=file]').eq(0).click()\ncy.get('[data-cy=file]').eq(2).click(modifier)\ncy.get('[data-cy=file].selected').should('have.length', 2)\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 1127
    },
    {
      "id": "api/commands/click#no-args",
      "doc_id": "api/commands/click",
      "heading": "No Args",
      "heading_level": 3,
      "content_markdown": "### No Args\n\n#### Click a link in a nav\n\n```\ncy.get('[data-cy=nav] a').click()\n```\n\n#### Assert on the result of a click\n\nChaining further commands off the subject of `.click()` is unsafe, since the click can re-render or remove the element. Start a new chain from `cy` and assert on what the click changed.\n\n```\ncy.get('[data-cy=open-modal]').click()\ncy.get('[data-cy=modal]').should('be.visible')\n```\n\n#### Wait for the request a click sends\n\nRegister a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) before the click, then [`cy.wait()`](/llm/markdown/api/commands/wait.md) on its alias so the test continues only after the request completes.\n\n```\ncy.intercept('POST', '/api/todos').as('createTodo')\ncy.get('[data-cy=save]').click()\ncy.wait('@createTodo').its('response.statusCode').should('eq', 201)\n```\n\n#### Click a button that starts out disabled\n\n`.click()` retries its [actionability checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Disability), including the check that the element is not disabled, until the command times out. You don't need to assert that the button is enabled before clicking it.\n\nThis check reads the element's `disabled` property. A button marked only with `aria-disabled=\"true\"` is not disabled to Cypress, so `.click()` fires on it right away. For those buttons, assert on the attribute before clicking.\n\n```\ncy.get('[data-cy=email]').type('user@example.com')\n// waits until the submit button is no longer disabled\ncy.get('[data-cy=submit]').click()\n\n// a button disabled with aria-disabled instead\ncy.get('[data-cy=next]').should('not.have.attr', 'aria-disabled', 'true')\ncy.get('[data-cy=next]').click()\n```\n\n#### Click one element out of several matches\n\nWhen a query matches more than one element, narrow it to the one you want instead of passing `{ multiple: true }`. Use [`.first()`](/llm/markdown/api/commands/first.md), [`.eq()`](/llm/markdown/api/commands/eq.md), or [`cy.contains()`](/llm/markdown/api/commands/contains.md) with a selector and text.\n\n```\ncy.get('[data-cy=todo] [data-cy=delete]').first().click()\ncy.get('[data-cy=todo]').eq(2).find('[data-cy=delete]').click()\ncy.contains('button', 'Submit').click()\n```\n\n#### Dismiss what covers an element before clicking it\n\nWhen another element covers the one you want to click, deal with it the way a user would before reaching for [`{ force: true }`](#Force-a-click-regardless-of-its-actionable-state). Forcing skips the checks that would catch a real bug, such as a banner that blocks users from checking out.\n\n```\ncy.get('[data-cy=cookie-banner] [data-cy=accept]').click()\ncy.get('[data-cy=checkout]').click()\n```\n",
      "section": "api",
      "anchors": [
        "no-args"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 397
    },
    {
      "id": "api/commands/click#assert-on-the-result-of-a-click",
      "doc_id": "api/commands/click",
      "heading": "Assert on the result of a click",
      "heading_level": 4,
      "content_markdown": "#### Assert on the result of a click\n\nChaining further commands off the subject of `.click()` is unsafe, since the click can re-render or remove the element. Start a new chain from `cy` and assert on what the click changed.\n\n```\ncy.get('[data-cy=open-modal]').click()\ncy.get('[data-cy=modal]').should('be.visible')\n```\n",
      "section": "api",
      "anchors": [
        "assert-on-the-result-of-a-click"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 59
    },
    {
      "id": "api/commands/click#wait-for-the-request-a-click-sends",
      "doc_id": "api/commands/click",
      "heading": "Wait for the request a click sends",
      "heading_level": 4,
      "content_markdown": "#### Wait for the request a click sends\n\nRegister a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) before the click, then [`cy.wait()`](/llm/markdown/api/commands/wait.md) on its alias so the test continues only after the request completes.\n\n```\ncy.intercept('POST', '/api/todos').as('createTodo')\ncy.get('[data-cy=save]').click()\ncy.wait('@createTodo').its('response.statusCode').should('eq', 201)\n```\n",
      "section": "api",
      "anchors": [
        "wait-for-the-request-a-click-sends"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 47
    },
    {
      "id": "api/commands/click#click-a-button-that-starts-out-disabled",
      "doc_id": "api/commands/click",
      "heading": "Click a button that starts out disabled",
      "heading_level": 4,
      "content_markdown": "#### Click a button that starts out disabled\n\n`.click()` retries its [actionability checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Disability), including the check that the element is not disabled, until the command times out. You don't need to assert that the button is enabled before clicking it.\n\nThis check reads the element's `disabled` property. A button marked only with `aria-disabled=\"true\"` is not disabled to Cypress, so `.click()` fires on it right away. For those buttons, assert on the attribute before clicking.\n\n```\ncy.get('[data-cy=email]').type('user@example.com')\n// waits until the submit button is no longer disabled\ncy.get('[data-cy=submit]').click()\n\n// a button disabled with aria-disabled instead\ncy.get('[data-cy=next]').should('not.have.attr', 'aria-disabled', 'true')\ncy.get('[data-cy=next]').click()\n```\n",
      "section": "api",
      "anchors": [
        "click-a-button-that-starts-out-disabled"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 132
    },
    {
      "id": "api/commands/click#click-one-element-out-of-several-matches",
      "doc_id": "api/commands/click",
      "heading": "Click one element out of several matches",
      "heading_level": 4,
      "content_markdown": "#### Click one element out of several matches\n\nWhen a query matches more than one element, narrow it to the one you want instead of passing `{ multiple: true }`. Use [`.first()`](/llm/markdown/api/commands/first.md), [`.eq()`](/llm/markdown/api/commands/eq.md), or [`cy.contains()`](/llm/markdown/api/commands/contains.md) with a selector and text.\n\n```\ncy.get('[data-cy=todo] [data-cy=delete]').first().click()\ncy.get('[data-cy=todo]').eq(2).find('[data-cy=delete]').click()\ncy.contains('button', 'Submit').click()\n```\n",
      "section": "api",
      "anchors": [
        "click-one-element-out-of-several-matches"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 63
    },
    {
      "id": "api/commands/click#dismiss-what-covers-an-element-before-clicking-it",
      "doc_id": "api/commands/click",
      "heading": "Dismiss what covers an element before clicking it",
      "heading_level": 4,
      "content_markdown": "#### Dismiss what covers an element before clicking it\n\nWhen another element covers the one you want to click, deal with it the way a user would before reaching for [`{ force: true }`](#Force-a-click-regardless-of-its-actionable-state). Forcing skips the checks that would catch a real bug, such as a banner that blocks users from checking out.\n\n```\ncy.get('[data-cy=cookie-banner] [data-cy=accept]').click()\ncy.get('[data-cy=checkout]').click()\n```\n",
      "section": "api",
      "anchors": [
        "dismiss-what-covers-an-element-before-clicking-it"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 79
    },
    {
      "id": "api/commands/click#position",
      "doc_id": "api/commands/click",
      "heading": "Position",
      "heading_level": 3,
      "content_markdown": "### Position\n\n#### Specify a corner of the element to click\n\nClick the top right corner of the button.\n\n```\ncy.get('[data-cy=submit]').click('topRight')\n```\n\n#### Click outside an element to dismiss it\n\nClose a dropdown or popover the way a user would, by clicking an empty area of the page. Cypress clicks whatever element is at the position you choose, so target an element and position that are empty in your app. Avoid the top left corner of `body`, which in many layouts holds a logo or navigation link that navigates away.\n\n```\ncy.get('[data-cy=menu-toggle]').click()\ncy.get('[data-cy=main-content]').click('topRight')\ncy.get('[data-cy=menu]').should('not.exist')\n```\n",
      "section": "api",
      "anchors": [
        "position"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 127
    },
    {
      "id": "api/commands/click#click-outside-an-element-to-dismiss-it",
      "doc_id": "api/commands/click",
      "heading": "Click outside an element to dismiss it",
      "heading_level": 4,
      "content_markdown": "#### Click outside an element to dismiss it\n\nClose a dropdown or popover the way a user would, by clicking an empty area of the page. Cypress clicks whatever element is at the position you choose, so target an element and position that are empty in your app. Avoid the top left corner of `body`, which in many layouts holds a logo or navigation link that navigates away.\n\n```\ncy.get('[data-cy=menu-toggle]').click()\ncy.get('[data-cy=main-content]').click('topRight')\ncy.get('[data-cy=menu]').should('not.exist')\n```\n",
      "section": "api",
      "anchors": [
        "click-outside-an-element-to-dismiss-it"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 97
    },
    {
      "id": "api/commands/click#coordinates",
      "doc_id": "api/commands/click",
      "heading": "Coordinates",
      "heading_level": 3,
      "content_markdown": "### Coordinates\n\n#### Specify explicit coordinates relative to the top left corner\n\nThe click below is issued inside of the element (15px from the left and 40px from the top).\n\n```\ncy.get('[data-cy=top-banner]').click(15, 40)\n```\n",
      "section": "api",
      "anchors": [
        "coordinates"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 45
    },
    {
      "id": "api/commands/click#specify-explicit-coordinates-relative-to-the-top-left-corner",
      "doc_id": "api/commands/click",
      "heading": "Specify explicit coordinates relative to the top left corner",
      "heading_level": 4,
      "content_markdown": "#### Specify explicit coordinates relative to the top left corner\n\nThe click below is issued inside of the element (15px from the left and 40px from the top).\n\n```\ncy.get('[data-cy=top-banner]').click(15, 40)\n```\n",
      "section": "api",
      "anchors": [
        "specify-explicit-coordinates-relative-to-the-top-left-corner"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 43
    },
    {
      "id": "api/commands/click#options",
      "doc_id": "api/commands/click",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\n#### Control where Cypress scrolls the element before clicking\n\nCypress scrolls the element into view before clicking it, aligning it to the top of its scrollable container by default. If a `position: fixed` or `position: sticky` element such as a header then covers it, Cypress [scrolls past the covering element](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) until the element is clear.\n\nWhen that isn't enough, or when you want the element in a predictable spot, pass `scrollBehavior`. Center the element in the viewport, or set each axis separately with a `{ block, inline }` object.\n\n```\ncy.get('[data-cy=row-42] button').click({ scrollBehavior: 'center' })\ncy.get('[data-cy=carousel-item]').click({\n  scrollBehavior: { block: 'center', inline: 'nearest' },\n})\n```\n\n#### Force a click regardless of its actionable state\n\nForcing a click overrides the [actionable checks](/llm/markdown/app/core-concepts/interacting-with-elements.md#Forcing) Cypress applies and fires the events.\n\n```\ncy.get('[data-cy=close]').as('closeBtn')\ncy.get('@closeBtn').click({ force: true })\n```\n\n#### Force a click with position argument\n\n```\ncy.get('[data-cy=collapse-sidebar]').click('bottomLeft', { force: true })\n```\n\n#### Force a click with relative coordinates\n\n```\ncy.get('[data-cy=footer] [data-cy=next]').click(5, 60, { force: true })\n```\n\n#### Click every element that matches a selector\n\nBy default, Cypress errors if you try to click multiple elements. When you pass `{ multiple: true }`, Cypress clicks each element in turn, gives each click its own full timeout, and logs each click to the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log).\n\n```\ncy.get('[data-cy=expand-section]').click({ multiple: true })\n```\n\n#### Click with key combinations\n\nThe `.click()` command may also be fired with key modifiers to simulate holding key combinations while clicking, such as `ALT + click`.\n\nYou can also use key combinations during [.type()](/llm/markdown/api/commands/type.md). This offers options to hold down keys across multiple commands. See [Key Combinations](/llm/markdown/api/commands/type.md#Key-Combinations) for more information.\n\nThe following keys can be combined with `.click()` through the `options`.\n\n| Option | Notes |\n| --- | --- |\n| `altKey` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |\n| `ctrlKey` | Activates the control key. Aliases: `controlKey`. |\n| `metaKey` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |\n| `shiftKey` | Activates the shift key. |\n\n#### Shift click\n\n```\n// execute a SHIFT + click on the first file\ncy.get('[data-cy=file]').first().click({\n  shiftKey: true,\n})\n```\n\n#### Ctrl or Cmd click to select several items\n\nMany apps check the control key on Windows and Linux and the command key on macOS. Use [`Cypress.platform`](/llm/markdown/api/cypress-api/platform.md) to hold the key the app expects.\n\n```\nconst modifier =\n  Cypress.platform === 'darwin' ? { metaKey: true } : { ctrlKey: true }\n\ncy.get('[data-cy=file]').eq(0).click()\ncy.get('[data-cy=file]').eq(2).click(modifier)\ncy.get('[data-cy=file].selected').should('have.length', 2)\n```\n",
      "section": "api",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 555
    },
    {
      "id": "api/commands/click#control-where-cypress-scrolls-the-element-before-clicking",
      "doc_id": "api/commands/click",
      "heading": "Control where Cypress scrolls the element before clicking",
      "heading_level": 4,
      "content_markdown": "#### Control where Cypress scrolls the element before clicking\n\nCypress scrolls the element into view before clicking it, aligning it to the top of its scrollable container by default. If a `position: fixed` or `position: sticky` element such as a header then covers it, Cypress [scrolls past the covering element](/llm/markdown/app/core-concepts/interacting-with-elements.md#Scrolling) until the element is clear.\n\nWhen that isn't enough, or when you want the element in a predictable spot, pass `scrollBehavior`. Center the element in the viewport, or set each axis separately with a `{ block, inline }` object.\n\n```\ncy.get('[data-cy=row-42] button').click({ scrollBehavior: 'center' })\ncy.get('[data-cy=carousel-item]').click({\n  scrollBehavior: { block: 'center', inline: 'nearest' },\n})\n```\n",
      "section": "api",
      "anchors": [
        "control-where-cypress-scrolls-the-element-before-clicking"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 140
    },
    {
      "id": "api/commands/click#click-every-element-that-matches-a-selector",
      "doc_id": "api/commands/click",
      "heading": "Click every element that matches a selector",
      "heading_level": 4,
      "content_markdown": "#### Click every element that matches a selector\n\nBy default, Cypress errors if you try to click multiple elements. When you pass `{ multiple: true }`, Cypress clicks each element in turn, gives each click its own full timeout, and logs each click to the [Command Log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log).\n\n```\ncy.get('[data-cy=expand-section]').click({ multiple: true })\n```\n",
      "section": "api",
      "anchors": [
        "click-every-element-that-matches-a-selector"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 71
    },
    {
      "id": "api/commands/click#click-with-key-combinations",
      "doc_id": "api/commands/click",
      "heading": "Click with key combinations",
      "heading_level": 4,
      "content_markdown": "#### Click with key combinations\n\nThe `.click()` command may also be fired with key modifiers to simulate holding key combinations while clicking, such as `ALT + click`.\n\nYou can also use key combinations during [.type()](/llm/markdown/api/commands/type.md). This offers options to hold down keys across multiple commands. See [Key Combinations](/llm/markdown/api/commands/type.md#Key-Combinations) for more information.\n\nThe following keys can be combined with `.click()` through the `options`.\n\n| Option | Notes |\n| --- | --- |\n| `altKey` | Activates the alt key (option key for Mac). Aliases: `optionKey`. |\n| `ctrlKey` | Activates the control key. Aliases: `controlKey`. |\n| `metaKey` | Activates the meta key (Windows key or command key for Mac). Aliases: `commandKey`, `cmdKey`. |\n| `shiftKey` | Activates the shift key. |\n",
      "section": "api",
      "anchors": [
        "click-with-key-combinations"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 163
    },
    {
      "id": "api/commands/click#ctrl-or-cmd-click-to-select-several-items",
      "doc_id": "api/commands/click",
      "heading": "Ctrl or Cmd click to select several items",
      "heading_level": 4,
      "content_markdown": "#### Ctrl or Cmd click to select several items\n\nMany apps check the control key on Windows and Linux and the command key on macOS. Use [`Cypress.platform`](/llm/markdown/api/cypress-api/platform.md) to hold the key the app expects.\n\n```\nconst modifier =\n  Cypress.platform === 'darwin' ? { metaKey: true } : { ctrlKey: true }\n\ncy.get('[data-cy=file]').eq(0).click()\ncy.get('[data-cy=file]').eq(2).click(modifier)\ncy.get('[data-cy=file].selected').should('have.length', 2)\n```\n",
      "section": "api",
      "anchors": [
        "ctrl-or-cmd-click-to-select-several-items"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 75
    },
    {
      "id": "api/commands/click#notes",
      "doc_id": "api/commands/click",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Actionability\n\n#### The element must first reach actionability\n\n`.click()` is an \"action command\" that follows all the rules of [Actionability](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n\n### Focus\n\n#### Focus is given to the first focusable element\n\nFor example, clicking a `<span>` inside of a `<button>` gives the focus to the button, since that's what would happen in a real user scenario.\n\nCypress starts from the element at the click coordinates and walks up its ancestors to find a focusable element. That element can differ from the subject, for example when a descendant is positioned outside of its parent (per the CSS Object Model). If no ancestor is focusable, Cypress blurs the currently focused element instead, which matches real browser behavior.\n\n### Cancellation\n\n#### Pointerdown or mousedown cancellation prevents focus\n\nIf the `pointerdown` or `mousedown` event has its default action prevented (`e.preventDefault()`), Cypress does not give the element focus.\n\nWhen `pointerdown` is cancelled, Cypress also skips the `mousedown` and `mouseup` events, following the Pointer Events spec. It still sends `pointerup` and `click`.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 225
    },
    {
      "id": "api/commands/click#focus",
      "doc_id": "api/commands/click",
      "heading": "Focus",
      "heading_level": 3,
      "content_markdown": "### Focus\n\n#### Focus is given to the first focusable element\n\nFor example, clicking a `<span>` inside of a `<button>` gives the focus to the button, since that's what would happen in a real user scenario.\n\nCypress starts from the element at the click coordinates and walks up its ancestors to find a focusable element. That element can differ from the subject, for example when a descendant is positioned outside of its parent (per the CSS Object Model). If no ancestor is focusable, Cypress blurs the currently focused element instead, which matches real browser behavior.\n",
      "section": "api",
      "anchors": [
        "focus"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 127
    },
    {
      "id": "api/commands/click#focus-is-given-to-the-first-focusable-element",
      "doc_id": "api/commands/click",
      "heading": "Focus is given to the first focusable element",
      "heading_level": 4,
      "content_markdown": "#### Focus is given to the first focusable element\n\nFor example, clicking a `<span>` inside of a `<button>` gives the focus to the button, since that's what would happen in a real user scenario.\n\nCypress starts from the element at the click coordinates and walks up its ancestors to find a focusable element. That element can differ from the subject, for example when a descendant is positioned outside of its parent (per the CSS Object Model). If no ancestor is focusable, Cypress blurs the currently focused element instead, which matches real browser behavior.\n",
      "section": "api",
      "anchors": [
        "focus-is-given-to-the-first-focusable-element"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 124
    },
    {
      "id": "api/commands/click#cancellation",
      "doc_id": "api/commands/click",
      "heading": "Cancellation",
      "heading_level": 3,
      "content_markdown": "### Cancellation\n\n#### Pointerdown or mousedown cancellation prevents focus\n\nIf the `pointerdown` or `mousedown` event has its default action prevented (`e.preventDefault()`), Cypress does not give the element focus.\n\nWhen `pointerdown` is cancelled, Cypress also skips the `mousedown` and `mouseup` events, following the Pointer Events spec. It still sends `pointerup` and `click`.\n",
      "section": "api",
      "anchors": [
        "cancellation"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 68
    },
    {
      "id": "api/commands/click#pointerdown-or-mousedown-cancellation-prevents-focus",
      "doc_id": "api/commands/click",
      "heading": "Pointerdown or mousedown cancellation prevents focus",
      "heading_level": 4,
      "content_markdown": "#### Pointerdown or mousedown cancellation prevents focus\n\nIf the `pointerdown` or `mousedown` event has its default action prevented (`e.preventDefault()`), Cypress does not give the element focus.\n\nWhen `pointerdown` is cancelled, Cypress also skips the `mousedown` and `mouseup` events, following the Pointer Events spec. It still sends `pointerup` and `click`.\n",
      "section": "api",
      "anchors": [
        "pointerdown-or-mousedown-cancellation-prevents-focus"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 65
    },
    {
      "id": "api/commands/click#rules",
      "doc_id": "api/commands/click",
      "heading": "Rules",
      "heading_level": 2,
      "content_markdown": "## Rules\n\n### Requirements\n\n*   `.click()` requires being chained off a command that yields DOM element(s).\n*   `.click()` requires a single element unless you pass `{ multiple: true }`.\n*   `.click()` cannot be called on a `<select>` element. Use [`.select()`](/llm/markdown/api/commands/select.md) to change its value.\n\n### Assertions\n\n*   `.click()` automatically waits for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.click()` itself is not retried. It fires once when the element is actionable. Assertions chained after `.click()` are retried until they pass or time out. See [Only queries are retried](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried).\n\n### Timeouts\n\n*   `.click()` can time out waiting for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.click()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 156
    },
    {
      "id": "api/commands/click#requirements",
      "doc_id": "api/commands/click",
      "heading": "Requirements",
      "heading_level": 3,
      "content_markdown": "### Requirements\n\n*   `.click()` requires being chained off a command that yields DOM element(s).\n*   `.click()` requires a single element unless you pass `{ multiple: true }`.\n*   `.click()` cannot be called on a `<select>` element. Use [`.select()`](/llm/markdown/api/commands/select.md) to change its value.\n",
      "section": "api",
      "anchors": [
        "requirements"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 56
    },
    {
      "id": "api/commands/click#assertions",
      "doc_id": "api/commands/click",
      "heading": "Assertions",
      "heading_level": 3,
      "content_markdown": "### Assertions\n\n*   `.click()` automatically waits for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.click()` itself is not retried. It fires once when the element is actionable. Assertions chained after `.click()` are retried until they pass or time out. See [Only queries are retried](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried).\n",
      "section": "api",
      "anchors": [
        "assertions"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 60
    },
    {
      "id": "api/commands/click#command-log",
      "doc_id": "api/commands/click",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Click the button_**\n\n```\ncy.get('.action-btn').click()\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on `click` within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 43
    },
    {
      "id": "api/commands/click#history",
      "doc_id": "api/commands/click",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [15.20.0](/llm/markdown/app/references/changelog.md#15-20-0) | Option `scrollBehavior` now accepts a per-axis `{ block, inline }` object and the `'start'` and `'end'` alignments |\n| [6.1.0](/llm/markdown/app/references/changelog.md#6-1-0) | Added option `scrollBehavior` |\n| [3.5.0](/llm/markdown/app/references/changelog.md#3-5-0) | Added sending `mouseover`, `mousemove`, `mouseout`, `pointerdown`, `pointerup`, and `pointermove` during `.click()` |\n",
      "section": "api",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/api/commands/click.json",
      "token_estimate": 73
    }
  ]
}