> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-en/action-guides/scroll/scroll-to-element.md).

# Scroll to element

This action instructs the browser to intelligently calculate and scroll the page until the selected element appears within the viewport.

* Effect: Ensures that the target element is always in view before the tool performs a click or retrieves data. Accurate scrolling helps reduce the "element not in viewport" error commonly encountered on long web pages or those with lazy loading.

#### Configuration parameters:

* XPath: The XPath identifier path of the target element that you want to bring into view (e.g., `//button[@id="btn-load-more"]` or `//div[@class="footer-section"]`).

#### Real-world example: Bring a hidden button into view before clicking

Many modern websites implement interaction blocking technology (bot trap security). If a button (e.g., "Load more" button or "Confirm payment" button) is deeply hidden beneath the interface and has not been scrolled to, issuing a `Mouse click` command directly on the XPath of that button may result in a missed error from the system, or the website may refuse to acknowledge the click command due to the absence of user scroll behavior.

* Configuration steps:
  1. Drag the Scroll to element action into the flow ➔ Enter the XPath of the target button.
  2. Then drag the Mouse click (or Wait element) action immediately after to perform the interaction.
* Result: The browser will automatically and smoothly scroll down to the exact position containing that element, making it clearly visible on the interface, ensuring the next click command is executed successfully 100% like a real user.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-en/action-guides/scroll/scroll-to-element.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
