> 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/huong-dan-cac-action/mouse/mouse-press-and-hold.md).

# Mouse press and hold

Mouse press and hold là hành động ra lệnh cho con trỏ chuột thực hiện thao tác ấn nút chuột trái xuống và duy trì trạng thái nhấn giữ đó (chưa thả ra). Hành động này thường không đứng độc lập mà đóng vai trò là bước khởi đầu cho các thao tác phức tạp mô phỏng hành vi của người dùng thật.

🎥 Xem thêm video hướng dẫn: [Tại đây](https://youtu.be/kQZWs1I76Zo).

#### Cấu hình vị trí nhấn giữ:

Tương tự như các hành động tương tác chuột khác, bạn có thể chỉ định vị trí để nhấn giữ chuột theo 2 cơ chế chính:

* Theo XPath: Di chuyển đến tâm của phần tử được chỉ định bởi đường dẫn XPath trên trang web rồi nhấn giữ.
* Theo tọa độ: Di chuyển đến điểm ảnh cố định x,y hoặc truyền biến gộp tọa độ (Ví dụ biến `$pos` có dạng `900,800` thu được từ hành động Image search) để thực hiện nhấn giữ.

#### Ứng dụng thực tế:

Hành động này là một mắt xích bắt buộc khi bạn muốn thực hiện chuỗi thao tác Kéo và thả (Drag and Drop):

* Giải mã Captcha thanh trượt (Slider Captcha): Nhấn giữ thanh trượt (`Mouse press and hold`) ➔ Di chuyển chuột sang một khoảng tọa độ X để khớp hình ảnh (`Mouse move`) ➔ Thả chuột ra để hoàn tất xác minh (`Mouse release`).
* Thao tác vẽ hoặc chọn vùng: Nhấn giữ tại điểm đầu, di chuyển chuột để quét một vùng dữ liệu hoặc vẽ một đường thẳng trên các ứng dụng Canvas/Game, sau đó buông chuột.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gpmautomate.com/huong-dan-cac-action/mouse/mouse-press-and-hold.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
