{
  "doc": {
    "id": "api/utilities/$",
    "title": "Cypress.$",
    "description": "Cypress automatically includes jQuery and exposes it as Cypress.$.",
    "section": "api",
    "source_path": "/llm/markdown/api/utilities/$.md",
    "version": "29f95bf8bb06f320986f3749f5bf09a35a409eab",
    "updated_at": "2026-09-04T10:49:54.630Z",
    "headings": [
      {
        "id": "api/utilities/$#cypress",
        "text": "Cypress.$",
        "level": 1
      },
      {
        "id": "api/utilities/$#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/utilities/$#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/utilities/$#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/utilities/$#selector",
        "text": "Selector",
        "level": 3
      },
      {
        "id": "api/utilities/$#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/utilities/$#cypress-runs-immediately-and-does-not-wait-for-cy-commands",
        "text": "Cypress.$ runs immediately and does not wait for cy commands",
        "level": 3
      },
      {
        "id": "api/utilities/$#cypress-vs-cy",
        "text": "Cypress.$ vs. cy.$$",
        "level": 3
      },
      {
        "id": "api/utilities/$#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/utilities/$#syntax",
      "doc_id": "api/utilities/$",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\nCypress.$(selector)\n\n// other proxied jQuery methods\nCypress.$.Event\nCypress.$.Deferred\nCypress.$.ajax\nCypress.$.get\nCypress.$.getJSON\nCypress.$.getScript\nCypress.$.post\n```\n\n### Usage\n\n**Correct Usage**\n\n```\nCypress.$('p')\n```\n\n**Incorrect Usage**\n\n```\ncy.$('p') // Errors, cannot be chained off 'cy'\n```\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/utilities/$.json",
      "token_estimate": 48
    },
    {
      "id": "api/utilities/$#notes",
      "doc_id": "api/utilities/$",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Cypress.$ runs immediately and does not wait for `cy` commands\n\n`Cypress.$` queries the application under test's DOM _synchronously_, at the moment the line of code runs. Unlike [`cy.get()`](/llm/markdown/api/commands/get.md), it is not a queued command and does not wait for previous `cy` commands to finish.\n\n```\ncy.visit('/page-with-list')\n// runs immediately, before cy.visit() has navigated, so it queries the\n// previous (blank) page and returns an empty jQuery object: [jQuery{0}]\nconst $items = Cypress.$('li')\n```\n\nTo query the DOM _after_ prior commands have run, move the query into a [`.then()`](/llm/markdown/api/commands/then.md) callback, which Cypress defers until the preceding commands finish, or query off an element yielded by `cy`:\n\n```\ncy.visit('/page-with-list')\ncy.get('body').then(($body) => {\n  // runs after cy.visit() has finished and the page has rendered\n  const $items = $body.find('li')\n})\n```\n\nIf you reached for `Cypress.$` to conditionally do something based on whether an element exists, read the [Conditional Testing](/llm/markdown/app/guides/conditional-testing.md) guide first. The DOM must be in a known, stable state for this to be reliable.\n\n### Cypress.$ vs. cy.$$\n\nYou can also query DOM elements with `cy.$$`. But `Cypress.$` and `cy.$$` are different.\n\n`Cypress.$` refers to the `jQuery` function itself. You can do anything with `Cypress.$` if you can do it with the `jQuery` function. So, both of the examples below work.\n\n```\nCypress.$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // works\n```\n\n```\n$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // also works\n```\n\nBut `cy.$$` is a wrapper of the `jQuery.fn.init` function. In other words, you can only query DOM elements with `cy.$$`. Because of that, the jQuery utility functions like `jQuery.each`, `jQuery.grep` don't work with `cy.$$`.\n\n```\ncy.$$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // fails\n```\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/utilities/$.json",
      "token_estimate": 381
    },
    {
      "id": "api/utilities/$#cypress-runs-immediately-and-does-not-wait-for-cy-commands",
      "doc_id": "api/utilities/$",
      "heading": "Cypress.$ runs immediately and does not wait for cy commands",
      "heading_level": 3,
      "content_markdown": "### Cypress.$ runs immediately and does not wait for `cy` commands\n\n`Cypress.$` queries the application under test's DOM _synchronously_, at the moment the line of code runs. Unlike [`cy.get()`](/llm/markdown/api/commands/get.md), it is not a queued command and does not wait for previous `cy` commands to finish.\n\n```\ncy.visit('/page-with-list')\n// runs immediately, before cy.visit() has navigated, so it queries the\n// previous (blank) page and returns an empty jQuery object: [jQuery{0}]\nconst $items = Cypress.$('li')\n```\n\nTo query the DOM _after_ prior commands have run, move the query into a [`.then()`](/llm/markdown/api/commands/then.md) callback, which Cypress defers until the preceding commands finish, or query off an element yielded by `cy`:\n\n```\ncy.visit('/page-with-list')\ncy.get('body').then(($body) => {\n  // runs after cy.visit() has finished and the page has rendered\n  const $items = $body.find('li')\n})\n```\n\nIf you reached for `Cypress.$` to conditionally do something based on whether an element exists, read the [Conditional Testing](/llm/markdown/app/guides/conditional-testing.md) guide first. The DOM must be in a known, stable state for this to be reliable.\n",
      "section": "api",
      "anchors": [
        "cypress-runs-immediately-and-does-not-wait-for-cy-commands"
      ],
      "path": "/llm/json/chunked/api/utilities/$.json",
      "token_estimate": 217
    },
    {
      "id": "api/utilities/$#cypress-vs-cy",
      "doc_id": "api/utilities/$",
      "heading": "Cypress.$ vs. cy.$$",
      "heading_level": 3,
      "content_markdown": "### Cypress.$ vs. cy.$$\n\nYou can also query DOM elements with `cy.$$`. But `Cypress.$` and `cy.$$` are different.\n\n`Cypress.$` refers to the `jQuery` function itself. You can do anything with `Cypress.$` if you can do it with the `jQuery` function. So, both of the examples below work.\n\n```\nCypress.$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // works\n```\n\n```\n$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // also works\n```\n\nBut `cy.$$` is a wrapper of the `jQuery.fn.init` function. In other words, you can only query DOM elements with `cy.$$`. Because of that, the jQuery utility functions like `jQuery.each`, `jQuery.grep` don't work with `cy.$$`.\n\n```\ncy.$$.each([1, 2, 3], (index, value) => {\n  expect(index).to.eq(value)\n}) // fails\n```\n",
      "section": "api",
      "anchors": [
        "cypress-vs-cy"
      ],
      "path": "/llm/json/chunked/api/utilities/$.json",
      "token_estimate": 161
    }
  ]
}