{
  "doc": {
    "id": "api/commands/eq",
    "title": "eq | Cypress Documentation",
    "description": "Get a DOM element at a specific index in an array of elements in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/eq.md",
    "version": "24a73f8a97175663aaffd3b016289fb2a523a4ea",
    "updated_at": "2026-05-14T20:17:33.301Z",
    "headings": [
      {
        "id": "api/commands/eq#eq",
        "text": "eq",
        "level": 1
      },
      {
        "id": "api/commands/eq#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/eq#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/eq#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/eq#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/eq#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/eq#index",
        "text": "Index",
        "level": 3
      },
      {
        "id": "api/commands/eq#find-the-2nd-element-within-the-elements",
        "text": "Find the 2nd element within the elements",
        "level": 4
      },
      {
        "id": "api/commands/eq#make-an-assertion-on-the-3rd-row-of-a-table",
        "text": "Make an assertion on the 3rd row of a table",
        "level": 4
      },
      {
        "id": "api/commands/eq#index-from-end",
        "text": "Index From End",
        "level": 3
      },
      {
        "id": "api/commands/eq#find-the-2nd-from-the-last-element-within-the-elements",
        "text": "Find the 2nd from the last element within the elements",
        "level": 4
      },
      {
        "id": "api/commands/eq#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/eq#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/eq#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/eq#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/eq#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/eq#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/eq#syntax",
      "doc_id": "api/commands/eq",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.eq(index).eq(indexFromEnd).eq(index, options).eq(indexFromEnd, options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.get('tbody>tr').eq(0) // Yield first 'tr' in 'tbody'cy.get('ul>li').eq(4) // Yield fifth 'li' in 'ul'\n```\n\n**Incorrect Usage**\n\n```\ncy.eq(0) // Errors, cannot be chained off 'cy'cy.getCookies().eq(4) // Errors, 'getCookies' does not yield DOM element\n```\n\n### Arguments\n\n**index _(Number)_**\n\nA number indicating the index to find the element at within an array of elements. Starts with 0.\n\n**indexFromEnd _(Number)_**\n\nA negative number indicating the index position from the end to find the element at within an array of elements.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.eq()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.eq()` to resolve before [timing out](#Timeouts) |\n\n### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)\n\n*   `.eq()` yields the new DOM element it found.\n*   `.eq()` is a query, and it is _safe_ to chain further commands.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 233
    },
    {
      "id": "api/commands/eq#usage",
      "doc_id": "api/commands/eq",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.get('tbody>tr').eq(0) // Yield first 'tr' in 'tbody'cy.get('ul>li').eq(4) // Yield fifth 'li' in 'ul'\n```\n\n**Incorrect Usage**\n\n```\ncy.eq(0) // Errors, cannot be chained off 'cy'cy.getCookies().eq(4) // Errors, 'getCookies' does not yield DOM element\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 52
    },
    {
      "id": "api/commands/eq#arguments",
      "doc_id": "api/commands/eq",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**index _(Number)_**\n\nA number indicating the index to find the element at within an array of elements. Starts with 0.\n\n**indexFromEnd _(Number)_**\n\nA negative number indicating the index position from the end to find the element at within an array of elements.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.eq()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.eq()` to resolve before [timing out](#Timeouts) |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 135
    },
    {
      "id": "api/commands/eq#examples",
      "doc_id": "api/commands/eq",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Index\n\n#### Find the 2nd element within the elements\n\n```\n<ul>  <li>tabby</li>  <li>siamese</li>  <li>persian</li>  <li>sphynx</li>  <li>burmese</li></ul>\n```\n\n```\ncy.get('li').eq(1).should('contain', 'siamese') // true\n```\n\n#### Make an assertion on the 3rd row of a table\n\n```\n<table>  <tr>    <th>Breed</th>    <th>Origin</th>  </tr>  <tr>    <td>Siamese</td>    <td>Thailand</td>  </tr>  <tr>    <td>Sphynx</td>    <td>Canada</td>  </tr>  <tr>    <td>Persian</td>    <td>Iran</td>  </tr></table>\n```\n\n```\ncy.get('tr').eq(2).should('contain', 'Canada') //true\n```\n\n### Index From End\n\n#### Find the 2nd from the last element within the elements\n\n```\n<ul>  <li>tabby</li>  <li>siamese</li>  <li>persian</li>  <li>sphynx</li>  <li>burmese</li></ul>\n```\n\n```\ncy.get('li').eq(-2).should('contain', 'sphynx') // true\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 120
    },
    {
      "id": "api/commands/eq#index",
      "doc_id": "api/commands/eq",
      "heading": "Index",
      "heading_level": 3,
      "content_markdown": "### Index\n\n#### Find the 2nd element within the elements\n\n```\n<ul>  <li>tabby</li>  <li>siamese</li>  <li>persian</li>  <li>sphynx</li>  <li>burmese</li></ul>\n```\n\n```\ncy.get('li').eq(1).should('contain', 'siamese') // true\n```\n\n#### Make an assertion on the 3rd row of a table\n\n```\n<table>  <tr>    <th>Breed</th>    <th>Origin</th>  </tr>  <tr>    <td>Siamese</td>    <td>Thailand</td>  </tr>  <tr>    <td>Sphynx</td>    <td>Canada</td>  </tr>  <tr>    <td>Persian</td>    <td>Iran</td>  </tr></table>\n```\n\n```\ncy.get('tr').eq(2).should('contain', 'Canada') //true\n```\n",
      "section": "api",
      "anchors": [
        "index"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 79
    },
    {
      "id": "api/commands/eq#make-an-assertion-on-the-3rd-row-of-a-table",
      "doc_id": "api/commands/eq",
      "heading": "Make an assertion on the 3rd row of a table",
      "heading_level": 4,
      "content_markdown": "#### Make an assertion on the 3rd row of a table\n\n```\n<table>  <tr>    <th>Breed</th>    <th>Origin</th>  </tr>  <tr>    <td>Siamese</td>    <td>Thailand</td>  </tr>  <tr>    <td>Sphynx</td>    <td>Canada</td>  </tr>  <tr>    <td>Persian</td>    <td>Iran</td>  </tr></table>\n```\n\n```\ncy.get('tr').eq(2).should('contain', 'Canada') //true\n```\n",
      "section": "api",
      "anchors": [
        "make-an-assertion-on-the-3rd-row-of-a-table"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 47
    },
    {
      "id": "api/commands/eq#rules",
      "doc_id": "api/commands/eq",
      "heading": "Rules",
      "heading_level": 2,
      "content_markdown": "## Rules\n\n### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)\n\n*   `.eq()` requires being chained off a command that yields DOM element(s).\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `.eq()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until the element(s) [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).\n*   `.eq()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until all chained assertions have passed.\n\n### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)\n\n*   `.eq()` can time out waiting for the element(s) to [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).\n*   `.eq()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 105
    },
    {
      "id": "api/commands/eq#timeouts-learn-about-timeouts",
      "doc_id": "api/commands/eq",
      "heading": "Timeouts Learn about timeouts",
      "heading_level": 3,
      "content_markdown": "### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)\n\n*   `.eq()` can time out waiting for the element(s) to [exist in the DOM](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Implicit-Assertions).\n*   `.eq()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "timeouts-learn-about-timeouts"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 41
    },
    {
      "id": "api/commands/eq#command-log",
      "doc_id": "api/commands/eq",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Find the 4th `<li>` in the navigation_**\n\n```\ncy.get('.left-nav.nav').find('>li').eq(3)\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on the `eq` command within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/eq.json",
      "token_estimate": 51
    }
  ]
}