# Set Web Checkbox

The **Set Web Checkbox** building block checks or unchecks a checkbox in an already open browser window when working with web automation.

This block only works with browser windows that were previously opened using the **Start Web Browser** block.

Fully expanded, the **Set Web Checkbox** block shows the following properties:

**Note:** The screenshot on this page uses the **Elegance Design**, introduced in **2025.3**. If you are using an earlier version, your layout may look different.

## Quick-start

1. Drag **Set Web Checkbox** onto the canvas.
2. Connect the block in the flow and specify **Set Web Checkbox To Find** and **Set Checkbox state**. Optionally set **Source element** or **Browser window**, and adjust **Scroll to find** / await options and timeout-related settings if needed.
3. Run the flow when it’s ready.

## Building block parameters

### Parameters
- **Block header**: The green input connector triggers the block to start executing. The green output connector triggers when the checkbox has been set. You can rename the block by double-clicking the header text.

- **Set Web Checkbox To Find**: Contains the locator for the checkbox element to be set. Capture it by right-clicking and selecting **Capture new web element**. You can update it via **Edit web element** or remove it via **Clear web element**.

- **Set Checkbox state**: Controls whether the checkbox should be checked or unchecked.
  - **Set check**: Checks the checkbox.
  - **Set uncheck**: Unchecks a checkbox that is already checked.

- **Found element**: Outputs the found checkbox element in the browser window. This can be reused as a **Source element** in other blocks to narrow down later searches.

- **Not found**: Triggers if the checkbox element is not found before the timeout behavior completes. This is typically used to branch the execution flow or explicitly fail a case by connecting it to a **Fail** block.

- **Position found**: Outputs the browser canvas position where the element was found as **X, Y** coordinates. The top-left corner of the browser canvas is **0, 0**. Elements that are not visible typically report **0, 0**. Use the expander to work with X and Y separately.

- **Area found**: Outputs the browser canvas position and size of the found element as **X, Y, Width, Height**, starting from the upper-leftmost pixel. The top-left corner is **0, 0**. Use the expander to work with position/size and nested sub-properties separately.

- **Attributes**: Outputs all attributes on the found element as key–value pairs (including standard HTML attributes like `class`, `style`, `href`, and custom `data-xxx` attributes). If you only need one attribute, **Get Web Attribute** can be used instead.

- **CSS values**: Currently unused.

- **Visible**: Returns **True** if the found element is visible.

- **Tag name**: Outputs the tag name of the found element (for example `div`, `input`, `button`).

- **Source element**: Limits the search to only occur inside the provided source element. This is useful when you first find a container (like a table) and then search inside it.

- **Browser window**: Specifies which browser window to search in. Multiple browser windows are not supported by **Selenium Grid** or external cloud providers such as **Sauce Labs** and **BrowserStack**.

- **Use occurred**: Selects which occurrence to use if multiple matching elements are found. Select **All** to iterate through all occurrences.
  - **Current index**: Outputs the current index while iterating.
  - **Completed**: Triggers when all occurrences have been iterated.

- **Count**: Outputs the total number of found web elements that match the locator.

- **Default timeout**: Controls whether the block uses the default timeout from the flow settings or a custom timeout value.

- **Timeout (sec)**: Sets the maximum time spent searching for the checkbox element before giving up and triggering **Not found**. This field is used when **Default timeout** is not selected.

**Note:** All cases have a **global timeout** configured in the **Settings** panel. This is unrelated to the timeout of a single building block. However, a running case will automatically be cancelled if it runs for longer than the global timeout.

- **Scroll to find**: When set to a value other than **None**, the block scrolls while searching for the checkbox. This is useful in scrollable pages where elements load asynchronously (for example infinite scroll).
  - **Max repeats**: The maximum number of scroll attempts before the block stops searching.
  - **Amount**: How much scrolling is performed on each repeat.
  - **Delay (sec)**: The delay in seconds between each scroll.

- **Require valid imgs**: When enabled, locators targeting images (`img` tags) are additionally validated to ensure the image loads correctly by checking that the image source returns an HTTP **200** response.

- **Scroll into view**: When enabled, any found element is automatically scrolled into view.

- **Await not found**: When enabled, the block assumes the element is currently present and waits until it can no longer be found before proceeding. This can be useful when waiting for a “Loading…” indicator to disappear.

- **Await DOM change**: Delays searching until there have been no changes to the page’s DOM for a specified period (for example, three seconds). Regardless of this checkbox, the search proceeds after waiting a maximum of **30 seconds**.
  - **Await Timeout**: The number of seconds the DOM must have had no changes before proceeding.

- **Await Requests**: Delays searching until there have been no active XHR requests for a specified period (for example, three seconds). Regardless of this checkbox, the search proceeds after waiting a maximum of **30 seconds**.
  - **Await Timeout**: The number of seconds no XHR requests must have been active before proceeding.

## Resources

| **Topic** | **Description** |
| --- | --- |
| [Flows FAQ](https://docs.leapwork.com/faq/latest/leapwork-flow-faq/flows-faq) | Common questions about creating, running, and managing flows in Leapwork. |
| [Flows Troubleshooting](https://docs.leapwork.com/troubleshooting/latest/leapwork-flow-troubleshooting/flows-troubleshooting) | Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork. |
| [Strategy Editor](https://docs.leapwork.com/leapwork-flow/latest/working-with-leapwork/strategy-editor) | Guidelines for understanding and using the Strategy Editor in Leapwork to define, refine, and validate robust locator strategies for UI elements using DOM structure, tokens, and wildcards.
