{
  "doc": {
    "id": "api/commands/visit",
    "title": "visit | Cypress Documentation",
    "description": "Visit a remote URL in Cypress",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/visit.md",
    "version": "24a73f8a97175663aaffd3b016289fb2a523a4ea",
    "updated_at": "2026-05-14T20:17:33.301Z",
    "headings": [
      {
        "id": "api/commands/visit#visit",
        "text": "visit",
        "level": 1
      },
      {
        "id": "api/commands/visit#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/visit#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/visit#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/visit#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/visit#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/visit#url",
        "text": "URL",
        "level": 3
      },
      {
        "id": "api/commands/visit#visit-a-local-server-running-on-http-localhost-8000",
        "text": "Visit a local server running on http://localhost:8000",
        "level": 4
      },
      {
        "id": "api/commands/visit#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "api/commands/visit#change-the-default-timeout",
        "text": "Change the default timeout",
        "level": 4
      },
      {
        "id": "api/commands/visit#add-basic-auth-headers",
        "text": "Add basic auth headers",
        "level": 4
      },
      {
        "id": "api/commands/visit#provide-an-onbeforeload-callback-function",
        "text": "Provide an onBeforeLoad callback function",
        "level": 4
      },
      {
        "id": "api/commands/visit#provide-an-onload-callback-function",
        "text": "Provide an onLoad callback function",
        "level": 4
      },
      {
        "id": "api/commands/visit#add-query-parameters",
        "text": "Add query parameters",
        "level": 4
      },
      {
        "id": "api/commands/visit#submit-a-form",
        "text": "Submit a form",
        "level": 4
      },
      {
        "id": "api/commands/visit#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/visit#prefixes",
        "text": "Prefixes",
        "level": 3
      },
      {
        "id": "api/commands/visit#visit-is-automatically-prefixed-with-baseurl",
        "text": "Visit is automatically prefixed with baseUrl",
        "level": 4
      },
      {
        "id": "api/commands/visit#visit-local-files",
        "text": "Visit local files",
        "level": 4
      },
      {
        "id": "api/commands/visit#visit-local-file-when-baseurl-is-set",
        "text": "Visit local file when baseUrl is set",
        "level": 5
      },
      {
        "id": "api/commands/visit#redirects",
        "text": "Redirects",
        "level": 3
      },
      {
        "id": "api/commands/visit#visit-will-automatically-follow-redirects",
        "text": "Visit will automatically follow redirects",
        "level": 4
      },
      {
        "id": "api/commands/visit#protocol",
        "text": "Protocol",
        "level": 3
      },
      {
        "id": "api/commands/visit#protocol-can-be-omitted-from-common-hosts",
        "text": "Protocol can be omitted from common hosts",
        "level": 4
      },
      {
        "id": "api/commands/visit#window",
        "text": "Window",
        "level": 3
      },
      {
        "id": "api/commands/visit#visit-will-always-yield-the-remote-pages-window-object-when-it-resolves",
        "text": "Visit will always yield the remote page's window object when it resolves",
        "level": 4
      },
      {
        "id": "api/commands/visit#user-agent",
        "text": "User agent",
        "level": 3
      },
      {
        "id": "api/commands/visit#routing",
        "text": "Routing",
        "level": 3
      },
      {
        "id": "api/commands/visit#prevent-requests-before-a-remote-page-initially-loads",
        "text": "Prevent requests before a remote page initially loads",
        "level": 4
      },
      {
        "id": "api/commands/visit#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/visit#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/visit#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/visit#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/visit#visiting-cross-origin-sites",
        "text": "Visiting cross-origin sites",
        "level": 2
      },
      {
        "id": "api/commands/visit#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/visit#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/commands/visit#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/visit#syntax",
      "doc_id": "api/commands/visit",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\ncy.visit(url)cy.visit(url, options)cy.visit(options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.visit('/') // visits the baseUrlcy.visit('index.html') // visits the local file \"index.html\" if baseUrl is nullcy.visit('http://localhost:3000') // specify full URL if baseUrl is null or the domain is different the baseUrlcy.visit({  url: '/pages/hello.html',  method: 'GET',})\n```\n\n### Arguments\n\n**url _(String)_**\n\nThe URL to visit.\n\nCypress will prefix the URL with the `baseUrl` configured in your [global configuration](/llm/markdown/app/references/configuration.md#Global) if set.\n\nIf the `baseUrl` has not been set, you will need to specify a fully qualified URL or Cypress will attempt to act as your web server. See the [prefixes notes](#Prefixes) for more details.\n\n**Note:** visiting a new domain requires the Cypress window to reload. You cannot visit different super domains in a single test without the use of [`cy.origin()`](/llm/markdown/api/commands/origin.md).\n\n**options _(Object)_**\n\nPass in an options object to control the behavior of `cy.visit()`.\n\nBy default, the `cy.visit()` commands' will use the `pageLoadTimeout` and `baseUrl` set globally in your [configuration](/llm/markdown/app/references/configuration.md#Global).\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `url` | `null` | The URL to visit. This value will be appended to the `baseUrl` if one is configured. Behaves the same as the `url` argument. |\n| `method` | `GET` | The HTTP method to use in the visit. Can be `GET` or `POST`. |\n| `body` | `null` | An optional body to send along with a `POST` request. If it is a string, it will be passed along unmodified. If it is an object, it will be URL encoded to a string and sent with a `Content-Type: application/x-www-urlencoded` header. |\n| `headers` | `{}` | An object that maps HTTP header names to values to be sent along with the request. _Note:_ `headers` will only be sent for the initial `cy.visit()` request, not for any subsequent requests. |\n| `qs` | `null` | Query parameters to append to the `url` of the request |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `auth` | `null` | Adds Basic Authorization headers |\n| `failOnStatusCode` | `true` | Whether to fail on response codes other than `2xx` and `3xx` |\n| `onBeforeLoad` | `function` | Called before your page has loaded all of its resources. |\n| `onLoad` | `function` | Called once your page has fired its load event. |\n| `retryOnStatusCodeFailure` | `false` | Whether Cypress should automatically retry status code errors under the hood. Cypress will retry a request up to 4 times if this is set to true. |\n| `retryOnNetworkFailure` | `true` | Whether Cypress should automatically retry transient network errors under the hood. Cypress will retry a request up to 4 times if this is set to true. |\n| `timeout` | [`pageLoadTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.visit()` to resolve before [timing out](#Timeouts) Note: Network requests are limited by the underlying operating system, and may still time out if this value is increased. |\n\nYou can also set all `cy.visit()` commands' `pageLoadTimeout` and `baseUrl` globally in the [Cypress configuration](/llm/markdown/app/references/configuration.md).\n\n### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)\n\n*   `cy.visit()` yields the `window` object after the page finishes loading.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the yielded `window` after `cy.visit()`.\n\nLet's confirm the `window.navigator.language` after visiting the site:\n\n```\ncy.visit('/') // yields the window object  .its('navigator.language') // yields window.navigator.language  .should('equal', 'en-US') // asserts the expected value\n```\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 755
    },
    {
      "id": "api/commands/visit#usage",
      "doc_id": "api/commands/visit",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.visit('/') // visits the baseUrlcy.visit('index.html') // visits the local file \"index.html\" if baseUrl is nullcy.visit('http://localhost:3000') // specify full URL if baseUrl is null or the domain is different the baseUrlcy.visit({  url: '/pages/hello.html',  method: 'GET',})\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 53
    },
    {
      "id": "api/commands/visit#arguments",
      "doc_id": "api/commands/visit",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**url _(String)_**\n\nThe URL to visit.\n\nCypress will prefix the URL with the `baseUrl` configured in your [global configuration](/llm/markdown/app/references/configuration.md#Global) if set.\n\nIf the `baseUrl` has not been set, you will need to specify a fully qualified URL or Cypress will attempt to act as your web server. See the [prefixes notes](#Prefixes) for more details.\n\n**Note:** visiting a new domain requires the Cypress window to reload. You cannot visit different super domains in a single test without the use of [`cy.origin()`](/llm/markdown/api/commands/origin.md).\n\n**options _(Object)_**\n\nPass in an options object to control the behavior of `cy.visit()`.\n\nBy default, the `cy.visit()` commands' will use the `pageLoadTimeout` and `baseUrl` set globally in your [configuration](/llm/markdown/app/references/configuration.md#Global).\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `url` | `null` | The URL to visit. This value will be appended to the `baseUrl` if one is configured. Behaves the same as the `url` argument. |\n| `method` | `GET` | The HTTP method to use in the visit. Can be `GET` or `POST`. |\n| `body` | `null` | An optional body to send along with a `POST` request. If it is a string, it will be passed along unmodified. If it is an object, it will be URL encoded to a string and sent with a `Content-Type: application/x-www-urlencoded` header. |\n| `headers` | `{}` | An object that maps HTTP header names to values to be sent along with the request. _Note:_ `headers` will only be sent for the initial `cy.visit()` request, not for any subsequent requests. |\n| `qs` | `null` | Query parameters to append to the `url` of the request |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `auth` | `null` | Adds Basic Authorization headers |\n| `failOnStatusCode` | `true` | Whether to fail on response codes other than `2xx` and `3xx` |\n| `onBeforeLoad` | `function` | Called before your page has loaded all of its resources. |\n| `onLoad` | `function` | Called once your page has fired its load event. |\n| `retryOnStatusCodeFailure` | `false` | Whether Cypress should automatically retry status code errors under the hood. Cypress will retry a request up to 4 times if this is set to true. |\n| `retryOnNetworkFailure` | `true` | Whether Cypress should automatically retry transient network errors under the hood. Cypress will retry a request up to 4 times if this is set to true. |\n| `timeout` | [`pageLoadTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `cy.visit()` to resolve before [timing out](#Timeouts) Note: Network requests are limited by the underlying operating system, and may still time out if this value is increased. |\n\nYou can also set all `cy.visit()` commands' `pageLoadTimeout` and `baseUrl` globally in the [Cypress configuration](/llm/markdown/app/references/configuration.md).\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 613
    },
    {
      "id": "api/commands/visit#yields-learn-about-subject-management",
      "doc_id": "api/commands/visit",
      "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*   `cy.visit()` yields the `window` object after the page finishes loading.\n*   It is [unsafe](/llm/markdown/app/core-concepts/retry-ability.md#Only-queries-are-retried) to chain further commands that rely on the yielded `window` after `cy.visit()`.\n\nLet's confirm the `window.navigator.language` after visiting the site:\n\n```\ncy.visit('/') // yields the window object  .its('navigator.language') // yields window.navigator.language  .should('equal', 'en-US') // asserts the expected value\n```\n",
      "section": "api",
      "anchors": [
        "yields-learn-about-subject-management"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 80
    },
    {
      "id": "api/commands/visit#examples",
      "doc_id": "api/commands/visit",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### URL\n\n#### Visit a local server running on `http://localhost:8000`\n\n`cy.visit()` resolves when the remote page fires its `load` event.\n\n```\ncy.visit('http://localhost:8000')\n```\n\n### Options\n\n#### Change the default timeout\n\nOverrides the `pageLoadTimeout` set globally in your [configuration](/llm/markdown/app/references/configuration.md) for this page load.\n\n```\n// Wait 30 seconds for page 'load' eventcy.visit('/index.html', { timeout: 30000 })\n```\n\n#### Add basic auth headers\n\nCypress will automatically apply the right authorization headers if you're attempting to visit an application that requires [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).\n\nProvide the `username` and `password` in the `auth` object. Then all subsequent requests matching the origin you're testing will have these attached at the network level.\n\n```\ncy.visit('https://example.cypress.io/', {  auth: {    username: 'wile',    password: 'coyote',  },})\n```\n\nYou can also provide the username and password directly in the URL.\n\n```\n// this is the same thing as providing the auth objectcy.visit('https://wile:coyote@example.cypress.io')\n```\n\nCypress will automatically attach this header at the network proxy level, outside of the browser. Therefore you **will not** see this header in the Dev Tools.\n\n#### Provide an `onBeforeLoad` callback function\n\n`onBeforeLoad` is called as soon as possible, before your page has loaded all of its resources. Your scripts will not be ready at this point, but it's a great hook to potentially manipulate the page.\n\n```\ncy.visit('http://localhost:3000/#dashboard', {  onBeforeLoad: (contentWindow) => {    // contentWindow is the remote page's window object  },})\n```\n\nCheck out our example recipes using `cy.visit()`'s `onBeforeLoad` option to:\n\n*   [Bootstrapping your App](/llm/markdown/app/references/recipes.md#Server-Communication)\n*   [Set a token to `localStorage` for login during Single Sign On](/llm/markdown/app/references/recipes.md#Logging-In)\n*   [Stub `window.fetch`](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)\n\n#### Provide an `onLoad` callback function\n\n`onLoad` is called once your page has fired its `load` event. All of the scripts, stylesheets, html and other resources are guaranteed to be available at this point.\n\n```\ncy.visit('http://localhost:3000/#/users', {  onLoad: (contentWindow) => {    // contentWindow is the remote page's window object    if (contentWindow.angular) {      // do something    }  },})\n```\n\n#### Add query parameters\n\nYou can provide query parameters as an object to `cy.visit()` by passing `qs` to `options`.\n\n```\n// visits http://localhost:3500/users?page=1&role=admincy.visit('http://localhost:3500/users', {  qs: {    page: '1',    role: 'admin',  },})\n```\n\nThe parameters passed to `qs` will be merged into existing query parameters on the `url`.\n\n```\n// visits https://example.cypress.io/users?page=1&admin=truecy.visit('https://example.cypress.io/users?page=1', {  qs: { admin: true },})\n```\n\n#### Submit a form\n\nTo send a request that looks like a user submitting an HTML form, use a `POST` method with a `body` containing the form values:\n\n```\ncy.visit({  url: 'http://localhost:3000/cgi-bin/newsletterSignup',  method: 'POST',  body: {    name: 'George P. Burdell',    email: 'burdell@microsoft.com',  },})\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 556
    },
    {
      "id": "api/commands/visit#options",
      "doc_id": "api/commands/visit",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\n#### Change the default timeout\n\nOverrides the `pageLoadTimeout` set globally in your [configuration](/llm/markdown/app/references/configuration.md) for this page load.\n\n```\n// Wait 30 seconds for page 'load' eventcy.visit('/index.html', { timeout: 30000 })\n```\n\n#### Add basic auth headers\n\nCypress will automatically apply the right authorization headers if you're attempting to visit an application that requires [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).\n\nProvide the `username` and `password` in the `auth` object. Then all subsequent requests matching the origin you're testing will have these attached at the network level.\n\n```\ncy.visit('https://example.cypress.io/', {  auth: {    username: 'wile',    password: 'coyote',  },})\n```\n\nYou can also provide the username and password directly in the URL.\n\n```\n// this is the same thing as providing the auth objectcy.visit('https://wile:coyote@example.cypress.io')\n```\n\nCypress will automatically attach this header at the network proxy level, outside of the browser. Therefore you **will not** see this header in the Dev Tools.\n\n#### Provide an `onBeforeLoad` callback function\n\n`onBeforeLoad` is called as soon as possible, before your page has loaded all of its resources. Your scripts will not be ready at this point, but it's a great hook to potentially manipulate the page.\n\n```\ncy.visit('http://localhost:3000/#dashboard', {  onBeforeLoad: (contentWindow) => {    // contentWindow is the remote page's window object  },})\n```\n\nCheck out our example recipes using `cy.visit()`'s `onBeforeLoad` option to:\n\n*   [Bootstrapping your App](/llm/markdown/app/references/recipes.md#Server-Communication)\n*   [Set a token to `localStorage` for login during Single Sign On](/llm/markdown/app/references/recipes.md#Logging-In)\n*   [Stub `window.fetch`](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)\n\n#### Provide an `onLoad` callback function\n\n`onLoad` is called once your page has fired its `load` event. All of the scripts, stylesheets, html and other resources are guaranteed to be available at this point.\n\n```\ncy.visit('http://localhost:3000/#/users', {  onLoad: (contentWindow) => {    // contentWindow is the remote page's window object    if (contentWindow.angular) {      // do something    }  },})\n```\n\n#### Add query parameters\n\nYou can provide query parameters as an object to `cy.visit()` by passing `qs` to `options`.\n\n```\n// visits http://localhost:3500/users?page=1&role=admincy.visit('http://localhost:3500/users', {  qs: {    page: '1',    role: 'admin',  },})\n```\n\nThe parameters passed to `qs` will be merged into existing query parameters on the `url`.\n\n```\n// visits https://example.cypress.io/users?page=1&admin=truecy.visit('https://example.cypress.io/users?page=1', {  qs: { admin: true },})\n```\n\n#### Submit a form\n\nTo send a request that looks like a user submitting an HTML form, use a `POST` method with a `body` containing the form values:\n\n```\ncy.visit({  url: 'http://localhost:3000/cgi-bin/newsletterSignup',  method: 'POST',  body: {    name: 'George P. Burdell',    email: 'burdell@microsoft.com',  },})\n```\n",
      "section": "api",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 523
    },
    {
      "id": "api/commands/visit#change-the-default-timeout",
      "doc_id": "api/commands/visit",
      "heading": "Change the default timeout",
      "heading_level": 4,
      "content_markdown": "#### Change the default timeout\n\nOverrides the `pageLoadTimeout` set globally in your [configuration](/llm/markdown/app/references/configuration.md) for this page load.\n\n```\n// Wait 30 seconds for page 'load' eventcy.visit('/index.html', { timeout: 30000 })\n```\n",
      "section": "api",
      "anchors": [
        "change-the-default-timeout"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 41
    },
    {
      "id": "api/commands/visit#add-basic-auth-headers",
      "doc_id": "api/commands/visit",
      "heading": "Add basic auth headers",
      "heading_level": 4,
      "content_markdown": "#### Add basic auth headers\n\nCypress will automatically apply the right authorization headers if you're attempting to visit an application that requires [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).\n\nProvide the `username` and `password` in the `auth` object. Then all subsequent requests matching the origin you're testing will have these attached at the network level.\n\n```\ncy.visit('https://example.cypress.io/', {  auth: {    username: 'wile',    password: 'coyote',  },})\n```\n\nYou can also provide the username and password directly in the URL.\n\n```\n// this is the same thing as providing the auth objectcy.visit('https://wile:coyote@example.cypress.io')\n```\n\nCypress will automatically attach this header at the network proxy level, outside of the browser. Therefore you **will not** see this header in the Dev Tools.\n",
      "section": "api",
      "anchors": [
        "add-basic-auth-headers"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 149
    },
    {
      "id": "api/commands/visit#provide-an-onbeforeload-callback-function",
      "doc_id": "api/commands/visit",
      "heading": "Provide an onBeforeLoad callback function",
      "heading_level": 4,
      "content_markdown": "#### Provide an `onBeforeLoad` callback function\n\n`onBeforeLoad` is called as soon as possible, before your page has loaded all of its resources. Your scripts will not be ready at this point, but it's a great hook to potentially manipulate the page.\n\n```\ncy.visit('http://localhost:3000/#dashboard', {  onBeforeLoad: (contentWindow) => {    // contentWindow is the remote page's window object  },})\n```\n\nCheck out our example recipes using `cy.visit()`'s `onBeforeLoad` option to:\n\n*   [Bootstrapping your App](/llm/markdown/app/references/recipes.md#Server-Communication)\n*   [Set a token to `localStorage` for login during Single Sign On](/llm/markdown/app/references/recipes.md#Logging-In)\n*   [Stub `window.fetch`](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)\n",
      "section": "api",
      "anchors": [
        "provide-an-onbeforeload-callback-function"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 116
    },
    {
      "id": "api/commands/visit#provide-an-onload-callback-function",
      "doc_id": "api/commands/visit",
      "heading": "Provide an onLoad callback function",
      "heading_level": 4,
      "content_markdown": "#### Provide an `onLoad` callback function\n\n`onLoad` is called once your page has fired its `load` event. All of the scripts, stylesheets, html and other resources are guaranteed to be available at this point.\n\n```\ncy.visit('http://localhost:3000/#/users', {  onLoad: (contentWindow) => {    // contentWindow is the remote page's window object    if (contentWindow.angular) {      // do something    }  },})\n```\n",
      "section": "api",
      "anchors": [
        "provide-an-onload-callback-function"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 77
    },
    {
      "id": "api/commands/visit#add-query-parameters",
      "doc_id": "api/commands/visit",
      "heading": "Add query parameters",
      "heading_level": 4,
      "content_markdown": "#### Add query parameters\n\nYou can provide query parameters as an object to `cy.visit()` by passing `qs` to `options`.\n\n```\n// visits http://localhost:3500/users?page=1&role=admincy.visit('http://localhost:3500/users', {  qs: {    page: '1',    role: 'admin',  },})\n```\n\nThe parameters passed to `qs` will be merged into existing query parameters on the `url`.\n\n```\n// visits https://example.cypress.io/users?page=1&admin=truecy.visit('https://example.cypress.io/users?page=1', {  qs: { admin: true },})\n```\n",
      "section": "api",
      "anchors": [
        "add-query-parameters"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 77
    },
    {
      "id": "api/commands/visit#submit-a-form",
      "doc_id": "api/commands/visit",
      "heading": "Submit a form",
      "heading_level": 4,
      "content_markdown": "#### Submit a form\n\nTo send a request that looks like a user submitting an HTML form, use a `POST` method with a `body` containing the form values:\n\n```\ncy.visit({  url: 'http://localhost:3000/cgi-bin/newsletterSignup',  method: 'POST',  body: {    name: 'George P. Burdell',    email: 'burdell@microsoft.com',  },})\n```\n",
      "section": "api",
      "anchors": [
        "submit-a-form"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 59
    },
    {
      "id": "api/commands/visit#notes",
      "doc_id": "api/commands/visit",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Prefixes\n\n#### Visit is automatically prefixed with `baseUrl`\n\nCypress will prefix the URL with the `baseUrl` if it has been set. Configure `baseUrl` in the [Cypress configuration](/llm/markdown/app/references/configuration.md) to prevent repeating yourself in every `cy.visit()` command.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\ncy.visit('dashboard') // Visits http://localhost:3000/#/dashboard\n```\n\nIf you would like to visit a different host when the `baseUrl` has been set, provide the fully qualified URL you would like to go to.\n\n```\ncy.visit('https://example.cypress.io')\n```\n\n#### Visit local files\n\nCypress will automatically attempt to serve your files if you don't provide a host and `baseUrl` **is not defined**. The path should be relative to your project's root folder (the directory that contains the [Cypress configuration file](/llm/markdown/app/references/configuration.md)).\n\nHaving Cypress serve your files is useful in smaller projects and example apps, but isn't recommended for production apps. It is always better to run your own server and provide the url to Cypress.\n\n```\ncy.visit('app/index.html')\n```\n\n##### Visit local file when `baseUrl` is set\n\nIf you have `baseUrl` set, but need to visit a local file in a single test or a group of tests, disable the `baseUrl` using [per-test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). Imagine this Cypress configuration:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\nThe first test visits the `baseUrl`, while the second test visits the local file.\n\n```\nit('visits base url', () => {  cy.visit('/')  cy.contains('h1', 'Kitchen Sink')})it('visits local file', { baseUrl: null }, () => {  cy.visit('index.html')  cy.contains('local file')})\n```\n\n### Redirects\n\n#### Visit will automatically follow redirects\n\n```\n// we aren't logged in, so our web server// redirected us to /logincy.visit('http://localhost:3000/admin')cy.url().should('match', /login/)\n```\n\n### Protocol\n\n#### Protocol can be omitted from common hosts\n\nCypress automatically prepends the `http://` protocol to common hosts. If you're not using one of these 3 hosts, then make sure to provide the protocol.\n\n```\ncy.visit('localhost:3000') // Visits http://localhost:3000cy.visit('0.0.0.0:3000') // Visits http://0.0.0.0:3000cy.visit('127.0.0.1:3000') // Visits http://127.0.0.1:3000\n```\n\n### Window\n\n#### Visit will always yield the remote page's `window` object when it resolves\n\n```\ncy.visit('index.html').then((contentWindow) => {  // contentWindow is the remote page's window object})\n```\n\n### User agent\n\nTrying to change the `User-Agent`?\n\nSee [how to override the browser's default user agent](/llm/markdown/app/faq.md#Can-I-override-or-change-the-default-user-agent-the-browser-uses).\n\n### Routing\n\n#### Prevent requests before a remote page initially loads\n\nOne common scenario Cypress supports is visiting a remote page and also preventing any Ajax requests from immediately going out.\n\nYou may think this works:\n\n```\n// this code may not work depending on implementationcy.visit('http://localhost:8000/#/app')cy.intercept('/users/**', { fixture: 'users' })\n```\n\nBut if your app makes a request upon being initialized, _the above code will not work_. `cy.visit()` will resolve once its `load` event fires. The [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) command is not processed until _after_ `cy.visit()` resolves.\n\nMany applications will have already begun routing, initialization, and requests by the time the `cy.visit()` in the above code resolves. Therefore creating a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) route will happen too late, and Cypress will not process the requests.\n\nLuckily Cypress supports this use case. Reverse the order of the commands:\n\n```\n// this code is probably what you wantcy.intercept('/users/**', {...})cy.visit('http://localhost:8000/#/app')\n```\n\nCypress will automatically apply the routes to the very next `cy.visit()` and does so immediately before any of your application code runs.\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 771
    },
    {
      "id": "api/commands/visit#prefixes",
      "doc_id": "api/commands/visit",
      "heading": "Prefixes",
      "heading_level": 3,
      "content_markdown": "### Prefixes\n\n#### Visit is automatically prefixed with `baseUrl`\n\nCypress will prefix the URL with the `baseUrl` if it has been set. Configure `baseUrl` in the [Cypress configuration](/llm/markdown/app/references/configuration.md) to prevent repeating yourself in every `cy.visit()` command.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\ncy.visit('dashboard') // Visits http://localhost:3000/#/dashboard\n```\n\nIf you would like to visit a different host when the `baseUrl` has been set, provide the fully qualified URL you would like to go to.\n\n```\ncy.visit('https://example.cypress.io')\n```\n\n#### Visit local files\n\nCypress will automatically attempt to serve your files if you don't provide a host and `baseUrl` **is not defined**. The path should be relative to your project's root folder (the directory that contains the [Cypress configuration file](/llm/markdown/app/references/configuration.md)).\n\nHaving Cypress serve your files is useful in smaller projects and example apps, but isn't recommended for production apps. It is always better to run your own server and provide the url to Cypress.\n\n```\ncy.visit('app/index.html')\n```\n\n##### Visit local file when `baseUrl` is set\n\nIf you have `baseUrl` set, but need to visit a local file in a single test or a group of tests, disable the `baseUrl` using [per-test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). Imagine this Cypress configuration:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\nThe first test visits the `baseUrl`, while the second test visits the local file.\n\n```\nit('visits base url', () => {  cy.visit('/')  cy.contains('h1', 'Kitchen Sink')})it('visits local file', { baseUrl: null }, () => {  cy.visit('index.html')  cy.contains('local file')})\n```\n",
      "section": "api",
      "anchors": [
        "prefixes"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 392
    },
    {
      "id": "api/commands/visit#visit-is-automatically-prefixed-with-baseurl",
      "doc_id": "api/commands/visit",
      "heading": "Visit is automatically prefixed with baseUrl",
      "heading_level": 4,
      "content_markdown": "#### Visit is automatically prefixed with `baseUrl`\n\nCypress will prefix the URL with the `baseUrl` if it has been set. Configure `baseUrl` in the [Cypress configuration](/llm/markdown/app/references/configuration.md) to prevent repeating yourself in every `cy.visit()` command.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'http://localhost:3000/#/',  },})\n```\n\n```\ncy.visit('dashboard') // Visits http://localhost:3000/#/dashboard\n```\n\nIf you would like to visit a different host when the `baseUrl` has been set, provide the fully qualified URL you would like to go to.\n\n```\ncy.visit('https://example.cypress.io')\n```\n",
      "section": "api",
      "anchors": [
        "visit-is-automatically-prefixed-with-baseurl"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 137
    },
    {
      "id": "api/commands/visit#visit-local-files",
      "doc_id": "api/commands/visit",
      "heading": "Visit local files",
      "heading_level": 4,
      "content_markdown": "#### Visit local files\n\nCypress will automatically attempt to serve your files if you don't provide a host and `baseUrl` **is not defined**. The path should be relative to your project's root folder (the directory that contains the [Cypress configuration file](/llm/markdown/app/references/configuration.md)).\n\nHaving Cypress serve your files is useful in smaller projects and example apps, but isn't recommended for production apps. It is always better to run your own server and provide the url to Cypress.\n\n```\ncy.visit('app/index.html')\n```\n\n##### Visit local file when `baseUrl` is set\n\nIf you have `baseUrl` set, but need to visit a local file in a single test or a group of tests, disable the `baseUrl` using [per-test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). Imagine this Cypress configuration:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\nThe first test visits the `baseUrl`, while the second test visits the local file.\n\n```\nit('visits base url', () => {  cy.visit('/')  cy.contains('h1', 'Kitchen Sink')})it('visits local file', { baseUrl: null }, () => {  cy.visit('index.html')  cy.contains('local file')})\n```\n",
      "section": "api",
      "anchors": [
        "visit-local-files"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 252
    },
    {
      "id": "api/commands/visit#visit-local-file-when-baseurl-is-set",
      "doc_id": "api/commands/visit",
      "heading": "Visit local file when baseUrl is set",
      "heading_level": 5,
      "content_markdown": "##### Visit local file when `baseUrl` is set\n\nIf you have `baseUrl` set, but need to visit a local file in a single test or a group of tests, disable the `baseUrl` using [per-test configuration](/llm/markdown/app/references/configuration.md#Test-Configuration). Imagine this Cypress configuration:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  e2e: {    baseUrl: 'https://example.cypress.io',  },})\n```\n\nThe first test visits the `baseUrl`, while the second test visits the local file.\n\n```\nit('visits base url', () => {  cy.visit('/')  cy.contains('h1', 'Kitchen Sink')})it('visits local file', { baseUrl: null }, () => {  cy.visit('index.html')  cy.contains('local file')})\n```\n",
      "section": "api",
      "anchors": [
        "visit-local-file-when-baseurl-is-set"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 148
    },
    {
      "id": "api/commands/visit#protocol",
      "doc_id": "api/commands/visit",
      "heading": "Protocol",
      "heading_level": 3,
      "content_markdown": "### Protocol\n\n#### Protocol can be omitted from common hosts\n\nCypress automatically prepends the `http://` protocol to common hosts. If you're not using one of these 3 hosts, then make sure to provide the protocol.\n\n```\ncy.visit('localhost:3000') // Visits http://localhost:3000cy.visit('0.0.0.0:3000') // Visits http://0.0.0.0:3000cy.visit('127.0.0.1:3000') // Visits http://127.0.0.1:3000\n```\n",
      "section": "api",
      "anchors": [
        "protocol"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 63
    },
    {
      "id": "api/commands/visit#protocol-can-be-omitted-from-common-hosts",
      "doc_id": "api/commands/visit",
      "heading": "Protocol can be omitted from common hosts",
      "heading_level": 4,
      "content_markdown": "#### Protocol can be omitted from common hosts\n\nCypress automatically prepends the `http://` protocol to common hosts. If you're not using one of these 3 hosts, then make sure to provide the protocol.\n\n```\ncy.visit('localhost:3000') // Visits http://localhost:3000cy.visit('0.0.0.0:3000') // Visits http://0.0.0.0:3000cy.visit('127.0.0.1:3000') // Visits http://127.0.0.1:3000\n```\n",
      "section": "api",
      "anchors": [
        "protocol-can-be-omitted-from-common-hosts"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 60
    },
    {
      "id": "api/commands/visit#routing",
      "doc_id": "api/commands/visit",
      "heading": "Routing",
      "heading_level": 3,
      "content_markdown": "### Routing\n\n#### Prevent requests before a remote page initially loads\n\nOne common scenario Cypress supports is visiting a remote page and also preventing any Ajax requests from immediately going out.\n\nYou may think this works:\n\n```\n// this code may not work depending on implementationcy.visit('http://localhost:8000/#/app')cy.intercept('/users/**', { fixture: 'users' })\n```\n\nBut if your app makes a request upon being initialized, _the above code will not work_. `cy.visit()` will resolve once its `load` event fires. The [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) command is not processed until _after_ `cy.visit()` resolves.\n\nMany applications will have already begun routing, initialization, and requests by the time the `cy.visit()` in the above code resolves. Therefore creating a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) route will happen too late, and Cypress will not process the requests.\n\nLuckily Cypress supports this use case. Reverse the order of the commands:\n\n```\n// this code is probably what you wantcy.intercept('/users/**', {...})cy.visit('http://localhost:8000/#/app')\n```\n\nCypress will automatically apply the routes to the very next `cy.visit()` and does so immediately before any of your application code runs.\n",
      "section": "api",
      "anchors": [
        "routing"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 221
    },
    {
      "id": "api/commands/visit#prevent-requests-before-a-remote-page-initially-loads",
      "doc_id": "api/commands/visit",
      "heading": "Prevent requests before a remote page initially loads",
      "heading_level": 4,
      "content_markdown": "#### Prevent requests before a remote page initially loads\n\nOne common scenario Cypress supports is visiting a remote page and also preventing any Ajax requests from immediately going out.\n\nYou may think this works:\n\n```\n// this code may not work depending on implementationcy.visit('http://localhost:8000/#/app')cy.intercept('/users/**', { fixture: 'users' })\n```\n\nBut if your app makes a request upon being initialized, _the above code will not work_. `cy.visit()` will resolve once its `load` event fires. The [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) command is not processed until _after_ `cy.visit()` resolves.\n\nMany applications will have already begun routing, initialization, and requests by the time the `cy.visit()` in the above code resolves. Therefore creating a [`cy.intercept()`](/llm/markdown/api/commands/intercept.md) route will happen too late, and Cypress will not process the requests.\n\nLuckily Cypress supports this use case. Reverse the order of the commands:\n\n```\n// this code is probably what you wantcy.intercept('/users/**', {...})cy.visit('http://localhost:8000/#/app')\n```\n\nCypress will automatically apply the routes to the very next `cy.visit()` and does so immediately before any of your application code runs.\n",
      "section": "api",
      "anchors": [
        "prevent-requests-before-a-remote-page-initially-loads"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 219
    },
    {
      "id": "api/commands/visit#rules",
      "doc_id": "api/commands/visit",
      "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*   `cy.visit()` requires being chained off of `cy`.\n*   `cy.visit()` requires the response to be `content-type: text/html`.\n*   `cy.visit()` requires the response code to be `2xx` after following redirects.\n*   `cy.visit()` requires the load `load` event to eventually fire.\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `cy.visit()` will automatically wait for assertions you have chained to pass\n\n### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)\n\n*   `cy.visit()` can time out waiting for the page to fire its `load` event.\n*   `cy.visit()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 127
    },
    {
      "id": "api/commands/visit#requirements-learn-about-chaining-commands",
      "doc_id": "api/commands/visit",
      "heading": "Requirements Learn about chaining commands",
      "heading_level": 3,
      "content_markdown": "### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)\n\n*   `cy.visit()` requires being chained off of `cy`.\n*   `cy.visit()` requires the response to be `content-type: text/html`.\n*   `cy.visit()` requires the response code to be `2xx` after following redirects.\n*   `cy.visit()` requires the load `load` event to eventually fire.\n",
      "section": "api",
      "anchors": [
        "requirements-learn-about-chaining-commands"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 60
    },
    {
      "id": "api/commands/visit#timeouts-learn-about-timeouts",
      "doc_id": "api/commands/visit",
      "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*   `cy.visit()` can time out waiting for the page to fire its `load` event.\n*   `cy.visit()` 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/visit.json",
      "token_estimate": 41
    },
    {
      "id": "api/commands/visit#visiting-cross-origin-sites",
      "doc_id": "api/commands/visit",
      "heading": "Visiting cross-origin sites",
      "heading_level": 2,
      "content_markdown": "## Visiting cross-origin sites\n\nAfter visiting a cross-origin site, to interact with the content, you must use a [`cy.origin()`](/llm/markdown/api/commands/origin.md) block.\n\nWhen visiting a cross-origin site, the `onBeforeLoad` and `onLoad` options are not supported.\n",
      "section": "api",
      "anchors": [
        "visiting-cross-origin-sites"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 44
    },
    {
      "id": "api/commands/visit#command-log",
      "doc_id": "api/commands/visit",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Visit example application in a `beforeEach`_**\n\n```\nbeforeEach(() => {  cy.visit('https://example.cypress.io/commands/viewport')})\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on `visit` within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 51
    },
    {
      "id": "api/commands/visit#history",
      "doc_id": "api/commands/visit",
      "heading": "History",
      "heading_level": 2,
      "content_markdown": "## History\n\n| Version | Changes |\n| --- | --- |\n| [11.0.0](/llm/markdown/app/references/changelog.md#11-0-0) | Removed `experimentalSessionAndOrigin` reference |\n| [3.5.0](/llm/markdown/app/references/changelog.md#3-5-0) | Added support for options `qs` |\n| [3.3.0](/llm/markdown/app/references/changelog.md#3-3-0) | Added support for options `retryOnStatusCodeFailure` and `retryOnNetworkFailure` |\n| [3.2.0](/llm/markdown/app/references/changelog.md#3-2-0) | Added options `url`, `method`, `body`, and `headers` |\n| [1.1.3](/llm/markdown/app/references/changelog.md#1-1-3) | Added option `failOnStatusCode` |\n| [0.18.2](/llm/markdown/app/references/changelog.md#0-18-2) | Automatically send `Accept: text/html,*/*` request header |\n| [0.18.2](/llm/markdown/app/references/changelog.md#0-18-2) | Automatically send `User-Agent` header |\n| [0.17.0](/llm/markdown/app/references/changelog.md#0-17-0) | Cannot `cy.visit()` two different super domains in a single test |\n| [0.6.8](/llm/markdown/app/references/changelog.md#0-6-8) | Added option `log` |\n| [0.4.3](/llm/markdown/app/references/changelog.md#0-4-3) | Added option `onBeforeLoad` |\n| [< 0.3.3](/llm/markdown/app/references/changelog.md#0-3-3) | `cy.visit()` command added |\n",
      "section": "api",
      "anchors": [
        "history"
      ],
      "path": "/llm/json/chunked/api/commands/visit.json",
      "token_estimate": 148
    }
  ]
}