> 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/action-shi-yong-zhi-nan/mouse/mouse-press-and-hold.md).

# Mouse press and hold

Mouse press and hold 是指挥鼠标指针执行按下鼠标左键并保持该按压状态(尚未松开)的操作动作。此操作通常不单独存在,而是作为模拟真实用户行为的复杂操作序列的起始步骤。

🎥 查看更多教程视频:[点击这里](https://youtu.be/kQZWs1I76Zo)。

#### 配置按压位置:

与其他鼠标交互操作类似,您可以通过两种主要方式指定鼠标按压的位置:

* 按 XPath:移动到网页上由 XPath 路径指定的元素中心,然后按下并保持。
* 按坐标:移动到固定的像素点 x,y,或传入包含坐标的合并变量(例如从 Image search 操作获取的 `$pos` 变量,格式为 `900,800`)以执行按压。

#### 实际应用:

当您想要执行拖放(Drag and Drop)操作序列时,此动作是必不可少的一环:

* 破解滑块验证码(Slider Captcha):按住滑块(`Mouse press and hold`)➔ 将鼠标移动到某个 X 坐标区间以匹配图像(`Mouse move`)➔ 松开鼠标以完成验证(`Mouse release`)。
* 绘图或选取区域操作:在起始点按住,移动鼠标以扫过一片数据区域或在 Canvas/Game 应用上绘制一条直线,然后松开鼠标。


---

# 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/action-shi-yong-zhi-nan/mouse/mouse-press-and-hold.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.
