# Infinitely Scroll an E-commerce Site

*The following example is a request we've prebuilt to show you Gaffa's capabilities on our* [*demo site.*](https://demo.gaffa.dev) ***You can run this request right now in the*** [***Gaffa API Playground***](https://gaffa.dev/dashboard/playground?templateId=infinite_scroll)***.***

Gaffa automates infinite scrolling on dynamic pages, such as e-commerce storefronts. Set a duration, and Gaffa will capture all content as it scrolls. Each session can be recorded as a video for playback, letting you debug or review the interaction.

## API Request

The request below uses the [POST endpoint](/docs/api-reference/post-v1-browser-requests.md) to open the demo site in the e-commerce site simulator, featuring an infinitely scrolling storefront. It will wait for and dismiss a dialog box, wait for a product to load, and then scroll down the page for a maximum of 20 seconds - if new items load, it will keep scrolling.

```json
{
  "url": "https://demo.gaffa.dev/simulate/ecommerce?loadTime=3&showModal=true&modalDelay=0&itemCount=infinite",
  "proxy_location": null,
  "async": false,
  "max_cache_age": 0,
  "settings": {
    "record_request": true,
    "actions": [
      {
        "type": "wait",
        "selector": "div[role=\"dialog\"]",
        "timeout": 10000
      },
      {
        "type": "click",
        "selector": "[data-testid=\"accept-all-button\"]"
      },
      {
        "type": "wait",
        "selector": "[data-testid^=\"product-1\"]",
        "timeout": 5000
      },
      {
        "type": "scroll",
        "percentage": 100,
        "max_scroll_time": 20000
      }
    ]
  }
}
```

## Actions

{% content-ref url="/pages/Py3syTPEzIuvQYXyaDso" %}
[Wait](/docs/features/browser-requests/actions/wait.md)
{% endcontent-ref %}

{% content-ref url="/pages/1Cx0fCd84ZhpvRD9FVxt" %}
[Click](/docs/features/browser-requests/actions/click.md)
{% endcontent-ref %}

{% content-ref url="/pages/6wXXyX2KmvSFDvKqwGOQ" %}
[Scroll](/docs/features/browser-requests/actions/scroll.md)
{% endcontent-ref %}

## Response

Here's a video showing Gaffa scrolling the page for 20 seconds as more items load.

{% embed url="<https://youtu.be/s4WsBYxGWOo>" %}
Gaffa scrolling to the bottom of a simulated ecommerce page!
{% endembed %}

## Read More

Read more about screen recording here. (TODO)

{% content-ref url="/pages/kzTlst3tKo255yz4YpDi" %}
[Get Started](/docs/get-started.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gaffa.dev/docs/features/browser-requests/api-playground-examples/infinitely-scroll-an-e-commerce-site.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
