> 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-zh/cao-zuo-zhi-nan/scroll/scroll-to-element.md).

# 滚动到元素

此操作指示浏览器智能计算并滚动页面，直到您选择的元素出现在屏幕视野中。

* 作用：确保目标元素始终位于观察区域内，以便工具执行点击或获取数据。准确的滚动有助于减少在长网页或懒加载页面上常见的“元素不在视口内”的错误。

#### 配置参数：

* XPath：您希望引入视野的目标元素的标识路径（XPath）（例如：`//button[@id="btn-load-more"]` 或 `//div[@class="footer-section"]`）。

#### 实际示例：在点击之前将被遮挡的按钮带入屏幕

许多现代网站采用隐性交互阻止技术（防止机器人攻击）。如果一个按钮（例如：“查看更多”按钮或“确认付款”按钮）深藏在界面下方且尚未滚动到，您直接对该按钮的XPath发出`Mouse click`命令可能会导致系统报告错误，或者网站拒绝记录点击命令，因为用户尚未进行滚动行为。

* 配置方法：
  1. 将“滚动到元素”操作拖入流程 ➔ 填写目标按钮的XPath。
  2. 接着将“鼠标点击”（或“等待元素”）操作拖到后面以进行交互。
* 结果：浏览器将自动平滑滚动到包含该元素的正确位置，使其在界面上清晰显示，从而确保下一次点击命令100%成功，如同真实用户操作。


---

# 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-zh/cao-zuo-zhi-nan/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.
