{
  "doc": {
    "id": "api/commands/select",
    "title": "select | Cypress Documentation",
    "description": "Select an option within a select in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/select.md",
    "version": "e6988a974973e9090ce70406c38cb2b9e0eac9fa",
    "updated_at": "2026-05-15T15:50:22.536Z",
    "headings": [
      {
        "id": "api/commands/select#select",
        "text": "select",
        "level": 1
      },
      {
        "id": "api/commands/select#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/select#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/select#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/select#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/select#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/select#text-content",
        "text": "Text Content",
        "level": 3
      },
      {
        "id": "api/commands/select#select-the-option-with-the-text-apples",
        "text": "Select the option with the text apples",
        "level": 4
      },
      {
        "id": "api/commands/select#value",
        "text": "Value",
        "level": 3
      },
      {
        "id": "api/commands/select#select-the-option-with-the-value-456",
        "text": "Select the option with the value \"456\"",
        "level": 4
      },
      {
        "id": "api/commands/select#index",
        "text": "Index",
        "level": 3
      },
      {
        "id": "api/commands/select#select-the-option-with-index-0",
        "text": "Select the option with index 0",
        "level": 4
      },
      {
        "id": "api/commands/select#select-multiple-options",
        "text": "Select multiple options",
        "level": 3
      },
      {
        "id": "api/commands/select#select-the-options-with-the-texts-apples-and-bananas",
        "text": "Select the options with the texts \"apples\" and \"bananas\"",
        "level": 4
      },
      {
        "id": "api/commands/select#select-the-options-with-the-values-456-and-457",
        "text": "Select the options with the values \"456\" and \"457\"",
        "level": 4
      },
      {
        "id": "api/commands/select#select-the-options-with-the-indexes-0-and-1",
        "text": "Select the options with the indexes 0 and 1",
        "level": 4
      },
      {
        "id": "api/commands/select#force-select",
        "text": "Force select",
        "level": 3
      },
      {
        "id": "api/commands/select#force-select-a-hidden-select",
        "text": "Force select a hidden <select>",
        "level": 4
      },
      {
        "id": "api/commands/select#force-select-a-disabled-select",
        "text": "Force select a disabled <select>",
        "level": 4
      },
      {
        "id": "api/commands/select#selected-option",
        "text": "Selected option",
        "level": 3
      },
      {
        "id": "api/commands/select#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/select#actionability",
        "text": "Actionability",
        "level": 3
      },
      {
        "id": "api/commands/select#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/select#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/select#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/select#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/select#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/select#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/select#syntax",
      "doc_id": "api/commands/select",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.select(value).select(values).select(value, options).select(values, options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.get('select').select('user-1') // Select the 'user-1' option\n```\n\n**Incorrect Usage**\n\n```\ncy.select('John Adams') // Errors, cannot be chained off 'cy'cy.clock().select() // Errors, 'clock' does not yield a <select> element\n```\n\n### Arguments\n\n**value _(String, Number)_**\n\nThe `value`, `index`, or text content of the `<option>` to be selected.\n\n**values _(Array)_**\n\nAn array of `values`, `indexes`, or text contents of the `<option>`s to be selected.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.select()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `force` | `false` | Forces the action, disables [waiting for actionability](#Assertions) |\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 `.select()` 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*   `.select()` 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 `.select()`.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 232
    },
    {
      "id": "api/commands/select#usage",
      "doc_id": "api/commands/select",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.get('select').select('user-1') // Select the 'user-1' option\n```\n\n**Incorrect Usage**\n\n```\ncy.select('John Adams') // Errors, cannot be chained off 'cy'cy.clock().select() // Errors, 'clock' does not yield a <select> element\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 45
    },
    {
      "id": "api/commands/select#arguments",
      "doc_id": "api/commands/select",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**value _(String, Number)_**\n\nThe `value`, `index`, or text content of the `<option>` to be selected.\n\n**values _(Array)_**\n\nAn array of `values`, `indexes`, or text contents of the `<option>`s to be selected.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.select()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `force` | `false` | Forces the action, disables [waiting for actionability](#Assertions) |\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 `.select()` to resolve before [timing out](#Timeouts) |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 137
    },
    {
      "id": "api/commands/select#yields-learn-about-subject-management",
      "doc_id": "api/commands/select",
      "heading": "Yields Learn about subject management",
      "heading_level": 3,
      "content_markdown": "### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)\n\n*   `.select()` 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 `.select()`.\n",
      "section": "api",
      "anchors": [
        "yields-learn-about-subject-management"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/select#examples",
      "doc_id": "api/commands/select",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Text Content\n\n#### Select the `option` with the text `apples`\n\n```\n<select>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\n// yields <option value=\"456\">apples</option>cy.get('select').select('apples').should('have.value', '456')\n```\n\n### Value\n\n#### Select the `option` with the value \"456\"\n\n```\n<select>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\n// yields <option value=\"456\">apples</option>cy.get('select').select('456').should('have.value', '456')\n```\n\n### Index\n\n#### Select the `option` with index 0\n\n```\n<select>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\n// yields <option value=\"456\">apples</option>cy.get('select').select(0).should('have.value', '456')\n```\n\n### Select multiple options\n\n#### Select the options with the texts \"apples\" and \"bananas\"\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select(['apples', 'bananas'])  .invoke('val')  .should('deep.equal', ['456', '458'])\n```\n\n#### Select the options with the values \"456\" and \"457\"\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select(['456', '457'])  .invoke('val')  .should('deep.equal', ['456', '457'])\n```\n\n#### Select the options with the indexes 0 and 1\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select([0, 1])  .invoke('val')  .should('deep.equal', ['456', '457'])\n```\n\n**Note:** Passing an array into `cy.select()` will select only the options matching values in the array, leaving all other options unselected (even those that were previously selected). In the same manner, calling `cy.select([])` with an empty array will clear selections on all options.\n\n### Force select\n\n#### Force select a hidden `<select>`\n\n```\n<select style=\"display: none;\">  <optgroup label=\"Fruits\">    <option value=\"banana\">Banana</option>    <option value=\"apple\">Apple</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('banana', { force: true })  .invoke('val')  .should('eq', 'banana')\n```\n\n#### Force select a disabled `<select>`\n\nPassing `{ force: true }` to `.select()` will override the actionability checks for selecting a disabled `<select>`. However, it will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See [this issue](https://github.com/cypress-io/cypress/issues/107) for more detail.\n\n```\n<select disabled>  <optgroup label=\"Veggies\">    <option value=\"okra\">Okra</option>    <option value=\"zucchini\">Zucchini</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('okra', { force: true })  .invoke('val')  .should('eq', 'okra')\n```\n\n### Selected option\n\nYou can get the currently selected option using the jQuery's [:selected selector](https://api.jquery.com/selected-selector/).\n\n```\n<select id=\"name\">  <option>Joe</option>  <option>Mary</option>  <option selected=\"selected\">Peter</option></select>\n```\n\n```\ncy.get('select#name option:selected').should('have.text', 'Peter')\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 463
    },
    {
      "id": "api/commands/select#select-multiple-options",
      "doc_id": "api/commands/select",
      "heading": "Select multiple options",
      "heading_level": 3,
      "content_markdown": "### Select multiple options\n\n#### Select the options with the texts \"apples\" and \"bananas\"\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select(['apples', 'bananas'])  .invoke('val')  .should('deep.equal', ['456', '458'])\n```\n\n#### Select the options with the values \"456\" and \"457\"\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select(['456', '457'])  .invoke('val')  .should('deep.equal', ['456', '457'])\n```\n\n#### Select the options with the indexes 0 and 1\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select([0, 1])  .invoke('val')  .should('deep.equal', ['456', '457'])\n```\n\n**Note:** Passing an array into `cy.select()` will select only the options matching values in the array, leaving all other options unselected (even those that were previously selected). In the same manner, calling `cy.select([])` with an empty array will clear selections on all options.\n",
      "section": "api",
      "anchors": [
        "select-multiple-options"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 179
    },
    {
      "id": "api/commands/select#select-the-options-with-the-indexes-0-and-1",
      "doc_id": "api/commands/select",
      "heading": "Select the options with the indexes 0 and 1",
      "heading_level": 4,
      "content_markdown": "#### Select the options with the indexes 0 and 1\n\n```\n<select multiple>  <option value=\"456\">apples</option>  <option value=\"457\">oranges</option>  <option value=\"458\">bananas</option></select>\n```\n\n```\ncy.get('select')  .select([0, 1])  .invoke('val')  .should('deep.equal', ['456', '457'])\n```\n\n**Note:** Passing an array into `cy.select()` will select only the options matching values in the array, leaving all other options unselected (even those that were previously selected). In the same manner, calling `cy.select([])` with an empty array will clear selections on all options.\n",
      "section": "api",
      "anchors": [
        "select-the-options-with-the-indexes-0-and-1"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 96
    },
    {
      "id": "api/commands/select#force-select",
      "doc_id": "api/commands/select",
      "heading": "Force select",
      "heading_level": 3,
      "content_markdown": "### Force select\n\n#### Force select a hidden `<select>`\n\n```\n<select style=\"display: none;\">  <optgroup label=\"Fruits\">    <option value=\"banana\">Banana</option>    <option value=\"apple\">Apple</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('banana', { force: true })  .invoke('val')  .should('eq', 'banana')\n```\n\n#### Force select a disabled `<select>`\n\nPassing `{ force: true }` to `.select()` will override the actionability checks for selecting a disabled `<select>`. However, it will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See [this issue](https://github.com/cypress-io/cypress/issues/107) for more detail.\n\n```\n<select disabled>  <optgroup label=\"Veggies\">    <option value=\"okra\">Okra</option>    <option value=\"zucchini\">Zucchini</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('okra', { force: true })  .invoke('val')  .should('eq', 'okra')\n```\n",
      "section": "api",
      "anchors": [
        "force-select"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 140
    },
    {
      "id": "api/commands/select#force-select-a-hidden-select",
      "doc_id": "api/commands/select",
      "heading": "Force select a hidden <select>",
      "heading_level": 4,
      "content_markdown": "#### Force select a hidden `<select>`\n\n```\n<select style=\"display: none;\">  <optgroup label=\"Fruits\">    <option value=\"banana\">Banana</option>    <option value=\"apple\">Apple</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('banana', { force: true })  .invoke('val')  .should('eq', 'banana')\n```\n",
      "section": "api",
      "anchors": [
        "force-select-a-hidden-select"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/select#force-select-a-disabled-select",
      "doc_id": "api/commands/select",
      "heading": "Force select a disabled <select>",
      "heading_level": 4,
      "content_markdown": "#### Force select a disabled `<select>`\n\nPassing `{ force: true }` to `.select()` will override the actionability checks for selecting a disabled `<select>`. However, it will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See [this issue](https://github.com/cypress-io/cypress/issues/107) for more detail.\n\n```\n<select disabled>  <optgroup label=\"Veggies\">    <option value=\"okra\">Okra</option>    <option value=\"zucchini\">Zucchini</option>  </optgroup>  <optgroup></optgroup></select>\n```\n\n```\ncy.get('select')  .select('okra', { force: true })  .invoke('val')  .should('eq', 'okra')\n```\n",
      "section": "api",
      "anchors": [
        "force-select-a-disabled-select"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 96
    },
    {
      "id": "api/commands/select#notes",
      "doc_id": "api/commands/select",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Actionability\n\n`.select()` is an action command that follows the rules of [Actionability](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n\nHowever, passing `{ force: true }` to `.select()` will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See [this issue](https://github.com/cypress-io/cypress/issues/107) for more detail.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 63
    },
    {
      "id": "api/commands/select#actionability",
      "doc_id": "api/commands/select",
      "heading": "Actionability",
      "heading_level": 3,
      "content_markdown": "### Actionability\n\n`.select()` is an action command that follows the rules of [Actionability](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n\nHowever, passing `{ force: true }` to `.select()` will not override the actionability checks for selecting a disabled `<option>` or an option within a disabled `<optgroup>`. See [this issue](https://github.com/cypress-io/cypress/issues/107) for more detail.\n",
      "section": "api",
      "anchors": [
        "actionability"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 60
    },
    {
      "id": "api/commands/select#rules",
      "doc_id": "api/commands/select",
      "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*   `.select()` requires being chained off a command that yields DOM element(s).\n*   `.select()` requires the element to be a `select`.\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `.select()` will automatically wait for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.select()` 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*   `.select()` can time out waiting for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.select()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 119
    },
    {
      "id": "api/commands/select#timeouts-learn-about-timeouts",
      "doc_id": "api/commands/select",
      "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*   `.select()` can time out waiting for the element to reach an [actionable state](/llm/markdown/app/core-concepts/interacting-with-elements.md).\n*   `.select()` 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/select.json",
      "token_estimate": 41
    },
    {
      "id": "api/commands/select#command-log",
      "doc_id": "api/commands/select",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Select the option with the text \"Homer Simpson\"_**\n\n```\ncy.get('select').select('Homer Simpson')\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on `select` within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/select.json",
      "token_estimate": 51
    }
  ]
}