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

# Page Interactions

Use the `jsScenario` parameter to simulate user interactions on the page before scraping. This enables you to handle dynamic pages that require clicking, waiting, or filling inputs to reveal content.

The value of `jsScenario` is an **array of steps**, executed sequentially. Each step is an object that defines a single action (e.g. click, scroll, wait, fill).

## Supported Actions

* **`click`** – Click an element using a CSS selector
* **`wait`** – Pause for a specific time (in milliseconds)
* **`waitFor`** – Wait until an element appears in the DOM
* **`waitForAndClick`** – Wait for an element and click it
* **`evaluate`** – Run custom JavaScript in the page context
* **`scrollX`**, **`scrollY`** – Scroll to a horizontal or vertical offset
* **`fill`** – Input values into fields using selectors

<Info>
  All actions are executed in order, one after another
</Info>

## Example: Load More and Scroll

```json theme={null}
[
  { "click": "#loadMoreBtn" },
  { "wait": 1500 },
  { "scrollY": 2000 }
]
```

This sequence clicks a button, waits and then scrolls the page.

## Example: Fill and Submit a Form

```json theme={null}
[
  { "fill": ["#email", "user@example.com"] },
  { "click": "#submit" },
  { "waitFor": ".confirmation" }
]
```

This fills an email field, clicks the submit button, and waits for a confirmation message.

## Example: Evaluate Custom JS

```json theme={null}
[
  { "evaluate": "document.body.style.background = 'red'" }
]
```

This runs arbitrary JavaScript in the browser context before scraping.

## Notes

* If an element is not found (e.g. `click` or `waitFor`), the request will fail
* `jsRendering` must be set to `true` for `jsScenario` to work
* Use `wait` conservatively - prefer `waitFor` to avoid unnecessary delays
