{
  "doc": {
    "id": "api/commands/scrollintoview",
    "title": "scrollIntoView | Cypress Documentation",
    "description": "Scroll an element into view in Cypress.",
    "section": "api",
    "source_path": "/llm/markdown/api/commands/scrollintoview.md",
    "version": "3cf5b86b3403f604bdf7f3e35025c3bc3865e02c",
    "updated_at": "2026-05-07T17:44:31.931Z",
    "headings": [
      {
        "id": "api/commands/scrollintoview#scrollintoview",
        "text": "scrollIntoView",
        "level": 1
      },
      {
        "id": "api/commands/scrollintoview#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/commands/scrollintoview#usage",
        "text": "Usage",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#yields-learn-about-subject-management",
        "text": "Yields Learn about subject management",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/commands/scrollintoview#scrolling",
        "text": "Scrolling",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#options",
        "text": "Options",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#use-linear-easing-animation-to-scroll",
        "text": "Use linear easing animation to scroll",
        "level": 4
      },
      {
        "id": "api/commands/scrollintoview#scroll-to-element-over-2000ms",
        "text": "Scroll to element over 2000ms",
        "level": 4
      },
      {
        "id": "api/commands/scrollintoview#scroll-150px-below-an-element",
        "text": "Scroll 150px below an element",
        "level": 4
      },
      {
        "id": "api/commands/scrollintoview#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/commands/scrollintoview#snapshots",
        "text": "Snapshots",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#snapshots-do-not-reflect-scroll-behavior",
        "text": "Snapshots do not reflect scroll behavior",
        "level": 4
      },
      {
        "id": "api/commands/scrollintoview#rules",
        "text": "Rules",
        "level": 2
      },
      {
        "id": "api/commands/scrollintoview#requirements-learn-about-chaining-commands",
        "text": "Requirements Learn about chaining commands",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#assertions-learn-about-assertions",
        "text": "Assertions Learn about assertions",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#timeouts-learn-about-timeouts",
        "text": "Timeouts Learn about timeouts",
        "level": 3
      },
      {
        "id": "api/commands/scrollintoview#command-log",
        "text": "Command Log",
        "level": 2
      },
      {
        "id": "api/commands/scrollintoview#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/commands/scrollintoview#syntax",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\n.scrollIntoView().scrollIntoView(options)\n```\n\n### Usage\n\n**Correct Usage**\n\n```\ncy.get('footer').scrollIntoView() // Scrolls 'footer' into view\n```\n\n**Incorrect Usage**\n\n```\ncy.scrollIntoView('footer') // Errors, cannot be chained off 'cy'cy.window().scrollIntoView() // Errors, 'window' does not yield DOM element\n```\n\n### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.scrollIntoView()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `duration` | `0` | Scrolls over the duration (in ms) |\n| `easing` | `swing` | Will scroll with the easing animation |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `offset` | `{top: 0, left: 0}` | Amount to scroll after the element has been scrolled into view |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.scrollIntoView()` 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*   `.scrollIntoView()` 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 `.scrollIntoView()`.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 227
    },
    {
      "id": "api/commands/scrollintoview#usage",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Usage",
      "heading_level": 3,
      "content_markdown": "### Usage\n\n**Correct Usage**\n\n```\ncy.get('footer').scrollIntoView() // Scrolls 'footer' into view\n```\n\n**Incorrect Usage**\n\n```\ncy.scrollIntoView('footer') // Errors, cannot be chained off 'cy'cy.window().scrollIntoView() // Errors, 'window' does not yield DOM element\n```\n",
      "section": "api",
      "anchors": [
        "usage"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 43
    },
    {
      "id": "api/commands/scrollintoview#arguments",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**options _(Object)_**\n\nPass in an options object to change the default behavior of `.scrollIntoView()`.\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `duration` | `0` | Scrolls over the duration (in ms) |\n| `easing` | `swing` | Will scroll with the easing animation |\n| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |\n| `offset` | `{top: 0, left: 0}` | Amount to scroll after the element has been scrolled into view |\n| `timeout` | [`defaultCommandTimeout`](/llm/markdown/app/references/configuration.md#Timeouts) | Time to wait for `.scrollIntoView()` to resolve before [timing out](#Timeouts) |\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 137
    },
    {
      "id": "api/commands/scrollintoview#yields-learn-about-subject-management",
      "doc_id": "api/commands/scrollintoview",
      "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*   `.scrollIntoView()` 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 `.scrollIntoView()`.\n",
      "section": "api",
      "anchors": [
        "yields-learn-about-subject-management"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 40
    },
    {
      "id": "api/commands/scrollintoview#examples",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Scrolling\n\n```\ncy.get('button#checkout').scrollIntoView().should('be.visible')\n```\n\n### Options\n\n#### Use linear easing animation to scroll\n\n```\ncy.get('.next-page').scrollIntoView({ easing: 'linear' })\n```\n\n#### Scroll to element over 2000ms\n\n```\ncy.get('footer').scrollIntoView({ duration: 2000 })\n```\n\n#### Scroll 150px below an element\n\n```\ncy.get('#nav').scrollIntoView({ offset: { top: 150, left: 0 } })\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 68
    },
    {
      "id": "api/commands/scrollintoview#options",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Options",
      "heading_level": 3,
      "content_markdown": "### Options\n\n#### Use linear easing animation to scroll\n\n```\ncy.get('.next-page').scrollIntoView({ easing: 'linear' })\n```\n\n#### Scroll to element over 2000ms\n\n```\ncy.get('footer').scrollIntoView({ duration: 2000 })\n```\n\n#### Scroll 150px below an element\n\n```\ncy.get('#nav').scrollIntoView({ offset: { top: 150, left: 0 } })\n```\n",
      "section": "api",
      "anchors": [
        "options"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 59
    },
    {
      "id": "api/commands/scrollintoview#notes",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### Snapshots\n\n#### Snapshots do not reflect scroll behavior\n\n_Cypress does not reflect the accurate scroll positions of any elements within snapshots._ If you want to see the actual scrolling behavior in action, we recommend using [`.pause()`](/llm/markdown/api/commands/pause.md) to walk through each command or [watching the video of the test run](/llm/markdown/app/guides/screenshots-and-videos.md#Videos).\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 69
    },
    {
      "id": "api/commands/scrollintoview#snapshots",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Snapshots",
      "heading_level": 3,
      "content_markdown": "### Snapshots\n\n#### Snapshots do not reflect scroll behavior\n\n_Cypress does not reflect the accurate scroll positions of any elements within snapshots._ If you want to see the actual scrolling behavior in action, we recommend using [`.pause()`](/llm/markdown/api/commands/pause.md) to walk through each command or [watching the video of the test run](/llm/markdown/app/guides/screenshots-and-videos.md#Videos).\n",
      "section": "api",
      "anchors": [
        "snapshots"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 67
    },
    {
      "id": "api/commands/scrollintoview#snapshots-do-not-reflect-scroll-behavior",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Snapshots do not reflect scroll behavior",
      "heading_level": 4,
      "content_markdown": "#### Snapshots do not reflect scroll behavior\n\n_Cypress does not reflect the accurate scroll positions of any elements within snapshots._ If you want to see the actual scrolling behavior in action, we recommend using [`.pause()`](/llm/markdown/api/commands/pause.md) to walk through each command or [watching the video of the test run](/llm/markdown/app/guides/screenshots-and-videos.md#Videos).\n",
      "section": "api",
      "anchors": [
        "snapshots-do-not-reflect-scroll-behavior"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 64
    },
    {
      "id": "api/commands/scrollintoview#rules",
      "doc_id": "api/commands/scrollintoview",
      "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*   `.scrollIntoView()` requires being chained off a command that yields DOM element(s).\n\n### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)\n\n*   `.scrollIntoView()` 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*   `.scrollIntoView()` can time out waiting for assertions you've added to pass.\n",
      "section": "api",
      "anchors": [
        "rules"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 72
    },
    {
      "id": "api/commands/scrollintoview#command-log",
      "doc_id": "api/commands/scrollintoview",
      "heading": "Command Log",
      "heading_level": 2,
      "content_markdown": "## Command Log\n\n**_Assert element is visible after scrolling it into view_**\n\n```\ncy.get('#scroll-horizontal button').scrollIntoView().should('be.visible')\n```\n\nThe commands above will display in the Command Log as:\n\nWhen clicking on the `scrollintoview` command within the command log, the console outputs the following:\n",
      "section": "api",
      "anchors": [
        "command-log"
      ],
      "path": "/llm/json/chunked/api/commands/scrollintoview.json",
      "token_estimate": 55
    }
  ]
}