> For the complete documentation index, see [llms.txt](https://docs.zerowork.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zerowork.io/using-zerowork/using-building-blocks/click-web-element.md).

# Click Web Element

<figure><img src="https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2F6lG2Cg2sqsgGDnV6ViIh%2Fclick_web_element_block.png?alt=media&amp;token=94d03565-f9a5-462b-a35b-cc0a94387dec" alt="" width="375"><figcaption></figcaption></figure>

The **Click Web Element** block clicks an element on the browser's active page: a button, link, checkbox, menu item, or anything else you can point to with a css selector or XPath.

{% hint style="info" %}
This block needs a page already open and acts on the active page. It finds the element by selector, so it works even on elements that aren't visible until you scroll; it scrolls to them for you.
{% endhint %}

## How To Use It

<figure><img src="https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2FiXEsMZi8qkptFgETDWfd%2Fclick_web_element_settings.png?alt=media&amp;token=fbb438c8-988e-422d-8168-47dee5bac15c" alt=""><figcaption></figcaption></figure>

### Web Element Selector

The CSS or XPath selector for the element to click. See [Using Selectors](https://docs.zerowork.io/using-zerowork/using-selectors).

{% hint style="warning" %}
If the selector matches more than one element, your TaskBot clicks the first match. Narrow the selector, or target by position, when you need a specific one.
{% endhint %}

#### Timeout

How long to wait for the element to appear and become clickable before the block fails, in seconds. The default is **15 seconds**. Raise it for elements that load slowly.

### Perform right-click

Click with the right mouse button instead of the left (for example, to open a website's own right-click menu). Left click is the default.

{% hint style="warning" %}
There are two different right-click menus in a web page, and this option can only reach one of them. Some websites build **their own** menu that appears when you right-click inside the page; this option can open that. It does **not** open your **browser's** built-in right-click menu, the one with *Open link in new tab*, *Save image as*, *Back*, *Inspect*, and so on. That menu belongs to the browser itself rather than the page, so a TaskBot can't open it or choose anything from it. If that's what you were after, do it another way instead: for example, read a link or image's address with [Save Web Element](https://docs.zerowork.io/using-zerowork/using-building-blocks/save-web-element) and open it, or use [Open Link](https://docs.zerowork.io/using-zerowork/using-building-blocks/open-link) with **Open in a new tab** checked.
{% endhint %}

### Use human-like clicking

Moves the mouse to the element and presses it the way a person would instead of an instant programmatic click. Use it on sites that watch for bot-like behavior.

#### Block-level Delays

**Min sec** and **Max sec** represent a pause after the click completes, before the next block runs. The wait is randomized between the two values, and setting both to the same number makes it fixed. This block defaults to **1 second**.

{% hint style="info" %}
See the [Delay](https://docs.zerowork.io/using-zerowork/using-building-blocks/delay) block for how these two fields behave, including decimals, references, and what happens when a field is left empty. See [Delay Times between the Building Blocks](https://docs.zerowork.io/using-zerowork/using-building-blocks/building-block-options/delay-times-between-the-building-blocks) for how block-level delays fit into a TaskBot's run.
{% endhint %}

## Things To Know

* **The web page element must be visible and clickable, but it can be off-screen.** The block auto-scrolls the element into view and waits, up to the **Timeout**, until it's actually clickable. Clickable here refers to **rendered** (an element hidden with `display:none`, `visibility:hidden`, or a zero size never qualifies), **not covered** by another element at the click point, **enabled** (not a disabled control), and no longer animating. "Visible" here means *rendered*, not "in the viewport right now"; something below the fold is fine, because the block scrolls to it.
* **A covering element can make this block fail.** If a cookie banner, modal, or sticky header sits over your target element, the click can't reach it and the block times out; it's logged as if the selector couldn't be found, even though the element is plainly on the page. Dismiss the overlay first: close an in-page banner with an earlier Click Web Element on its close button, or handle a browser native dialog with [Browser Alert](https://docs.zerowork.io/using-zerowork/using-building-blocks/browser-alert).
* **Use Try-Catch if a missing element shouldn't end the run.** By default a click that can't find its target stops the run; wrapping this block in a [Try-Catch](https://docs.zerowork.io/using-zerowork/using-building-blocks/try-catch) lets you catch that and decide what happens next instead.
* **Normal vs. human-like clicking.** A normal click is a direct, fast, reliable programmatic click; it's the right default for most sites. Human-like clicking trades speed for realistic mouse movement on anti-bot-sensitive sites.
* **If a click opens a browser dialog, handle it next.** When a click triggers a native alert, confirm, or prompt, that dialog is dismissed automatically; if you instead need it accepted (or need to answer a prompt), place a [Browser Alert](https://docs.zerowork.io/using-zerowork/using-building-blocks/browser-alert) block right after this one.

## Block Behavior

**When the element is found and clickable** the block clicks it (left or right, normal or human) and logs a success message.

**When the element can't be found or isn't clickable in time** the block fails and stops a TaskBot's run.

### Video Tutorial

{% embed url="<https://youtu.be/GLqe4bEVQNM?si=BTgulegKmIZQ17Fa>" %}
