> 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/mouse/mouse-click.md).

# 鼠标点击

Mouse click是控制鼠标指针在屏幕上特定位置执行点击（click）操作的行为。为了优化不同的界面交互情况，GPM Automate为您提供了3个灵活的设置选项：

#### 3种兼容所有界面的鼠标点击选择

**1. 基于XPath的点击（Web界面的默认设置）**

* 工作原理：您填写网页上元素的标识符路径（XPath）（例如：`//button[@id="submit"]`）。系统将自动查找此HTML标签，计算其在浏览器上的位置，并将鼠标移动到准确的点击位置。
* 应用：用于常规网页结构，具有明确源代码标签的固定按钮。

**2. 基于当前鼠标指针位置的点击**

* 工作原理：系统不会移动鼠标，而是在鼠标指针从之前的操作（如Mouse move或Random scroll）静止的位置直接执行点击命令。
* 应用：在您之前已经有一系列复杂的鼠标移动操作后，只需发出点击命令以激活。

**3. 基于坐标的点击（与图像搜索完美结合）**

* 工作原理：您直接输入屏幕上水平`X`和垂直`Y`（像素）坐标的位置，以便鼠标跳到该位置进行点击。
* 优化结合：这种点击方式通常与图像搜索操作结合使用。当\_Image search\_找到目标图像时，它将返回一个合并坐标变量（例如，默认变量名为`pos`），以文本字符串的形式包含X和Y轴，以逗号分隔：`900,800`。
* 配置方式：在\_Mouse click\_操作的坐标输入框中，您只需直接传递合并变量`$pos`。GPM Automate的智能系统将自动解析这个`900,800`的语法，以将鼠标移动到坐标x=900，y=800进行直接点击目标。
* 应用：用于点击位于Canvas（游戏）中的元素，深藏在安全Iframe中的按钮，或与没有固定XPath标签的组件进行交互。


---

# 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/mouse/mouse-click.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.
