{
  "doc": {
    "id": "api/commands/its",
    "title": "its | Cypress Documentation",
    "description": "Get a property's value on the previously yielded subject in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/its.md",
    "version": "48b03b5502f7aea1d0454750cce208f775403542",
    "updated_at": "2026-05-20T19:00:20.270Z",
    "headings": [
      {
        "id": "api/commands/its#its",
        "text": "its",
        "level": 1
      },
      {
        "id": "api/commands/its#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/its#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/its#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/its#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/its#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/its#objects",
        "text": "Objects",
        "level": 3
      },
      {
        "id": "api/commands/its#get-property",
        "text": "Get property",
        "level": 4
      },
      {
        "id": "api/commands/its#arrays",
        "text": "Arrays",
        "level": 3
      },
      {
        "id": "api/commands/its#get-index",
        "text": "Get index",
        "level": 4
      },
      {
        "id": "api/commands/its#dom-elements",
        "text": "DOM Elements",
        "level": 3
      },
      {
        "id": "api/commands/its#get-the-length-property-of-a-dom-element",
        "text": "Get the length property of a DOM element",
        "level": 4
      },
      {
        "id": "api/commands/its#requests",
        "text": "Requests",
        "level": 3
      },
      {
        "id": "api/commands/its#get-the-user-object-of-the-responses-body",
        "text": "Get the user object of the response's body",
        "level": 4
      },
      {
        "id": "api/commands/its#strings",
        "text": "Strings",
        "level": 3
      },
      {
        "id": "api/commands/its#get-length-of-title",
        "text": "Get length of title",
        "level": 4
      },
      {
        "id": "api/commands/its#functions",
        "text": "Functions",
        "level": 3
      },
      {
        "id": "api/commands/its#get-function-as-property",
        "text": "Get function as property",
        "level": 4
      },
      {
        "id": "api/commands/its#access-function-properties",
        "text": "Access function properties",
        "level": 4
      },
      {
        "id": "api/commands/its#use-its-to-test-window-fetch",
        "text": "Use .its() to test window.fetch",
        "level": 4
      },
      {
        "id": "api/commands/its#nested-properties",
        "text": "Nested Properties",
        "level": 3
      },
      {
        "id": "api/commands/its#existence",
        "text": "Existence",
        "level": 3
      },
      {
        "id": "api/commands/its#wait-for-some-property-to-exist-on-window",
        "text": "Wait for some property to exist on window",
        "level": 4
      },
      {
        "id": "api/commands/its#assert-that-a-property-does-not-exist-on-window",
        "text": "Assert that a property does not exist on window",
        "level": 4
      },
      {
        "id": "api/commands/its#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/its#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/its#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/its#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/its#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/its#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/commands/its#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/its#syntax",
      "doc_id": "api/commands/its",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.its(propertyName).its(propertyName, options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.wrap({ width: '50' }).its('width') // Get the 'width' propertycy.window().its('sessionStorage') // Get the 'sessionStorage' property\n```\n\n**Incorrect Usage**\n\n```\ncy.its('window') // Errors, cannot be chained off 'cy'cy.clearCookies().its('length') // Errors, 'clearCookies' does not yield Object\n```\n\n### Arguments\n\n**propertyName _(String, Number)_**\n\nIndex, name of property or name of nested properties (with dot notation) to get.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.its()`.\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 `.its()` 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*   `.its()` 'yields the value of the property.\n*   `.its()` is a query, and it is _safe_ to chain further commands.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 197
    },
    {
      "id": "api/commands/its#usage",
      "doc_id": "api/commands/its",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.wrap({ width: '50' }).its('width') // Get the 'width' propertycy.window().its('sessionStorage') // Get the 'sessionStorage' property\n```\n\n**Incorrect Usage**\n\n```\ncy.its('window') // Errors, cannot be chained off 'cy'cy.clearCookies().its('length') // Errors, 'clearCookies' does not yield Object\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 52
    },
    {
      "id": "api/commands/its#arguments",
      "doc_id": "api/commands/its",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**propertyName _(String, Number)_**\n\nIndex, name of property or name of nested properties (with dot notation) to get.\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.its()`.\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 `.its()` to resolve before [timing out](#Timeouts) |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 101
    },
    {
      "id": "api/commands/its#examples",
      "doc_id": "api/commands/its",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Objects\n\n#### Get property\n\n```\ncy.wrap({ age: 52 }).its('age').should('eq', 52) // true\n```\n\n### Arrays\n\n#### Get index\n\n```\ncy.wrap(['Wai Yan', 'Yu']).its(1).should('eq', 'Yu') // true\n```\n\n### DOM Elements\n\n#### Get the `length` property of a DOM element\n\n```\ncy.get('ul li') // this yields us a jquery object  .its('length') // calls 'length' property returning that value  .should('be.gt', 2) // ensure the length is greater than 2\n```\n\n### Requests\n\n#### Get the `user` object of the response's `body`\n\n```\ncy  .request(...)  .its('body.user')  .then(user => ...)\n```\n\nalternatively, use destructuring\n\n```\ncy  .request(...)  .its('body')  .then(({user}) => ...)\n```\n\n### Strings\n\n#### Get `length` of title\n\n```\ncy.title().its('length').should('eq', 24)\n```\n\n### Functions\n\n#### Get function as property\n\n```\nconst fn = () => {  return 42}cy.wrap({ getNum: fn }).its('getNum').should('be.a', 'function')\n```\n\n#### Access function properties\n\nYou can access functions to then drill into their own properties instead of invoking them.\n\n```\n// Your app code// a basic Factory constructorconst Factory = (arg) => {  // ...}Factory.create = (arg) => {  return new Factory(arg)}// assign it to the windowwindow.Factory = Factory\n```\n\n```\ncy.window() // yields window object  .its('Factory') // yields Factory function  .invoke('create', 'arg') // now invoke properties on it\n```\n\n#### Use `.its()` to test `window.fetch`\n\n[Check out our example recipe on testing `window.fetch` using `.its()`](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)\n\n### Nested Properties\n\nYou can drill into nested properties by using _dot notation_.\n\n```\nconst user = {  contacts: {    work: {      name: 'Kamil',    },  },}cy.wrap(user).its('contacts.work.name').should('eq', 'Kamil') // true\n```\n\n### Existence\n\n#### Wait for some property to exist on `window`\n\n```\ncy.window()  .its('globalProp')  .then((globalProp) => {    // do something now that window.globalProp exists  })\n```\n\n#### Assert that a property does not exist on `window`\n\n```\ncy.window().its('evilProp').should('not.exist')\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 383
    },
    {
      "id": "api/commands/its#dom-elements",
      "doc_id": "api/commands/its",
      "heading": "DOM Elements",
      "heading_level": 3,
      "content_markdown": "### DOM Elements\n\n#### Get the `length` property of a DOM element\n\n```\ncy.get('ul li') // this yields us a jquery object  .its('length') // calls 'length' property returning that value  .should('be.gt', 2) // ensure the length is greater than 2\n```\n",
      "section": "api",
      "anchors": [
        "dom-elements"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 55
    },
    {
      "id": "api/commands/its#get-the-length-property-of-a-dom-element",
      "doc_id": "api/commands/its",
      "heading": "Get the length property of a DOM element",
      "heading_level": 4,
      "content_markdown": "#### Get the `length` property of a DOM element\n\n```\ncy.get('ul li') // this yields us a jquery object  .its('length') // calls 'length' property returning that value  .should('be.gt', 2) // ensure the length is greater than 2\n```\n",
      "section": "api",
      "anchors": [
        "get-the-length-property-of-a-dom-element"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 51
    },
    {
      "id": "api/commands/its#requests",
      "doc_id": "api/commands/its",
      "heading": "Requests",
      "heading_level": 3,
      "content_markdown": "### Requests\n\n#### Get the `user` object of the response's `body`\n\n```\ncy  .request(...)  .its('body.user')  .then(user => ...)\n```\n\nalternatively, use destructuring\n\n```\ncy  .request(...)  .its('body')  .then(({user}) => ...)\n```\n",
      "section": "api",
      "anchors": [
        "requests"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/its#functions",
      "doc_id": "api/commands/its",
      "heading": "Functions",
      "heading_level": 3,
      "content_markdown": "### Functions\n\n#### Get function as property\n\n```\nconst fn = () => {  return 42}cy.wrap({ getNum: fn }).its('getNum').should('be.a', 'function')\n```\n\n#### Access function properties\n\nYou can access functions to then drill into their own properties instead of invoking them.\n\n```\n// Your app code// a basic Factory constructorconst Factory = (arg) => {  // ...}Factory.create = (arg) => {  return new Factory(arg)}// assign it to the windowwindow.Factory = Factory\n```\n\n```\ncy.window() // yields window object  .its('Factory') // yields Factory function  .invoke('create', 'arg') // now invoke properties on it\n```\n\n#### Use `.its()` to test `window.fetch`\n\n[Check out our example recipe on testing `window.fetch` using `.its()`](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)\n",
      "section": "api",
      "anchors": [
        "functions"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 143
    },
    {
      "id": "api/commands/its#access-function-properties",
      "doc_id": "api/commands/its",
      "heading": "Access function properties",
      "heading_level": 4,
      "content_markdown": "#### Access function properties\n\nYou can access functions to then drill into their own properties instead of invoking them.\n\n```\n// Your app code// a basic Factory constructorconst Factory = (arg) => {  // ...}Factory.create = (arg) => {  return new Factory(arg)}// assign it to the windowwindow.Factory = Factory\n```\n\n```\ncy.window() // yields window object  .its('Factory') // yields Factory function  .invoke('create', 'arg') // now invoke properties on it\n```\n",
      "section": "api",
      "anchors": [
        "access-function-properties"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 93
    },
    {
      "id": "api/commands/its#nested-properties",
      "doc_id": "api/commands/its",
      "heading": "Nested Properties",
      "heading_level": 3,
      "content_markdown": "### Nested Properties\n\nYou can drill into nested properties by using _dot notation_.\n\n```\nconst user = {  contacts: {    work: {      name: 'Kamil',    },  },}cy.wrap(user).its('contacts.work.name').should('eq', 'Kamil') // true\n```\n",
      "section": "api",
      "anchors": [
        "nested-properties"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/its#existence",
      "doc_id": "api/commands/its",
      "heading": "Existence",
      "heading_level": 3,
      "content_markdown": "### Existence\n\n#### Wait for some property to exist on `window`\n\n```\ncy.window()  .its('globalProp')  .then((globalProp) => {    // do something now that window.globalProp exists  })\n```\n\n#### Assert that a property does not exist on `window`\n\n```\ncy.window().its('evilProp').should('not.exist')\n```\n",
      "section": "api",
      "anchors": [
        "existence"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 52
    },
    {
      "id": "api/commands/its#rules",
      "doc_id": "api/commands/its",
      "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*   `.its()` requires being chained off a previous command.\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `.its()` will automatically [retry](/llm/markdown/app/core-concepts/retry-ability.md) until it has a property that is not `null` or `undefined`.\n\n### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)\n\n*   `.its()` can time out waiting for the property to exist.\n*   `.its()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 88
    },
    {
      "id": "api/commands/its#command-log",
      "doc_id": "api/commands/its",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Get `responseBody` of aliased route_**\n\n```\ncy.intercept('/comments', { fixture: 'comments.json' }).as('getComments')cy.get('#fetch-comments').click()cy.wait('@getComments')  .its('response.body')  .should(    'deep.eq',    JSON.stringify([      { id: 1, comment: 'hi' },      { id: 2, comment: 'there' },    ])  )\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on `its` within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 75
    },
    {
      "id": "api/commands/its#history",
      "doc_id": "api/commands/its",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [3.8.0](/llm/markdown/app/references/changelog.md#3-8-0) | Added support for `options` argument |\n| [3.7.0](/llm/markdown/app/references/changelog.md#3-7-0) | Added support for arguments of type Number for `propertyName` |\n",
      "section": "api",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/api/commands/its.json",
      "token_estimate": 45
    }
  ]
}