> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# scroll_to_load_content

Automatically scrolls through infinite scroll content by repeatedly scrolling to the bottom
until no new content loads or maximum scroll limit is reached.

```python theme={null}
async def scroll_to_load_content(
    source: Page | Locator,
    *,
    on_scroll_progress: Callable[[], None],
    max_scrolls: int,
    delay_s: float,
    min_height_change: int,
)
```

## Examples

<CodeGroup>
  ```python Basic Infinite Scroll handling theme={null}
  from typing import TypedDict
  from playwright.async_api import Page
  from intuned_browser import scroll_to_load_content
  class Params(TypedDict):
      pass
  async def automation(page: Page, params: Params, **_kwargs):
      # Scroll through entire page content
      await page.goto("https://sandbox.intuned.dev/infinite-scroll")
      await scroll_to_load_content(
          source=page,
      )
      # Will keep scrolling until the page has loaded all content or the max_scrolls is reached.
  ```

  ```python Scroll Specific Container theme={null}
  from typing import TypedDict
  from playwright.async_api import Page
  from intuned_browser import scroll_to_load_content
  class Params(TypedDict):
      pass
  async def automation(page: Page, params: Params, **_kwargs):
      # Scroll through a specific scrollable div
      await page.goto("https://docs.intunedhq.com/docs/00-getting-started/introduction")
      # This will scroll the sidebar content only and watch its height to change.
      container = page.locator("xpath=//div[@id='sidebar-content']")
      await scroll_to_load_content(
          source=container,
          max_scrolls=20
      )
      # Will keep scrolling until the sidebar content has loaded all content or the max_scrolls is reached.
  ```
</CodeGroup>

## Arguments

<ResponseField name="source" type="Page | Locator" required>
  The Playwright Page or Locator to scroll.
</ResponseField>

<ResponseField name="on_scroll_progress" type="Callable">
  Optional callback function to call during each scroll iteration. Defaults to lambda: None.
</ResponseField>

<ResponseField name="max_scrolls" type="int">
  Maximum number of scroll attempts before stopping. Defaults to 50.
</ResponseField>

<ResponseField name="delay_s" type="float">
  Delay in seconds between scroll attempts. Defaults to 0.1.
</ResponseField>

<ResponseField name="min_height_change" type="int">
  Minimum height change in pixels required to continue scrolling. Defaults to 100. If the page has loaded all content and we still haven't reached the max\_scrolls, the min\_height\_change will detect that no new content is loaded and stop the scrolling.
</ResponseField>

## Returns: `None`

Function completes when scrolling is finished
