> 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-guide/element/wait-element.md).

# Wait element

This action helps the tool pause and "watch" until an element on the webpage (such as a button or input field) appears before proceeding. If the waiting time elapses without the element appearing, the tool will skip it automatically.

* Effect: It helps the tool run "in sync" with the loading speed of the web. Instead of using a fixed wait command (Delay) that wastes time, this command allows the script to run as quickly as possible and avoids errors of not finding elements due to slow web loading.

🎥 See more instructional video: [Here](https://youtu.be/AwlJt1TG80U).

#### Configuration parameters:

* Element XPath: The XPath identifier path of the element you need to wait for on the webpage interface (e.g., `//button[@type="submit"]`).
* Timeout (s): The maximum limit time (in seconds) for the system to wait for the element to appear. If this time elapses and the element has not loaded, the script will automatically move on to the next action in the flow.

#### Practical example: Wait for the "Post" button to be ready after uploading an image

When you create a script to automatically post (Post) on social media. After you select an image file and click upload, the website system needs some time to process and render that image on the server. The "Post" button is often grayed out (Disabled) or not visible until the image has completely finished loading.

* Configuration method: Immediately after the image upload action, you insert the Wait element action.
  * Element XPath: Enter the XPath of the post button, for example: `//span[text()="Đăng bài"]/ancestor::button`.
  * Timeout: Set `20` (20 seconds).
* Operational logic: The system will continuously check the webpage. If the network is strong and the image loads within 2 seconds, the button appears, and the script will immediately execute the click command to post (saving 18 seconds of unnecessary waiting). If the network is weak, the system will patiently wait up to 20 seconds to avoid flow errors.

<figure><img src="https://2961903581-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpIRrmOLZkhHBXdAiidIw%2Fuploads%2Fgit-blob-af8567927223de2c30d4d25177225599e90f0777%2Fel-01.png?alt=media" alt=""><figcaption></figcaption></figure>


---

# 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/automate-en/action-guide/element/wait-element.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.
