> 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/selectors/how-to-build-custom-selectors/check-if-selector-is-correct-and-unique.md).

# Check if Selector Is Correct and Unique

Here is how you can check whether a selector is correct and unique before you run your TaskBot.

If you build with AI through the ZeroWork MCP, your AI assistant can test selectors against the live page for you. The steps below show how to check a selector by hand.

Open Chrome DevTools by right-clicking any spot on the webpage and selecting *Inspect*.

![](https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2Fwlo3bSijMCWgN2xKg0HQ%2FScreenshot%202022-04-06%20at%2021.00.44.png?alt=media\&token=6e17732b-de81-49ca-b98f-ff63a1195d1f)

Now enter the following command in the **Console** tab:

<mark style="background-color:yellow;">document.querySelectorAll("PASTE YOUR SELECTOR HERE")</mark>

In the example of Wikipedia's search button, it can be, for example, this selector (but you can use any other from the list you saw in the previous chapter [Robust Selector Tips](https://docs.zerowork.io/selectors/how-to-build-custom-selectors/robust-selector-tips.md)):

<mark style="background-color:yellow;">document.querySelectorAll("button\[class\*='button']\[type='submit']")</mark>

This is what it looks like in action:

![](https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2Ft7aVct4DZYXqCaVO5pWR%2FScreenshot%202022-04-06%20at%2021.03.34.png?alt=media\&token=7d499560-638d-4e71-bb6d-90ac3219873d)

Once you hit *Enter*, you will see that there is an element shown:

![](https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2FoLzpkUO4E27RzO0FwTEE%2FScreenshot%202022-04-06%20at%2021.03.34%20copy.png?alt=media\&token=a42c471b-2d33-48c6-bac5-2bce7a339826)

Once you expand the shown element and hover over it, you will see the button highlighted on the left side that is identified by that selector.

![](https://3220183989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg9LcR8XM7TGOzOCDGsCS%2Fuploads%2FnWXqQOT0dSiJXnUKwH39%2FScreenshot%202022-04-06%20at%2021.06.34.png?alt=media\&token=092998fb-34c9-4b14-8672-d1fc524c6f69)

If your selector is not unique enough, the result will contain multiple elements. This means you need to make the selector more specific. **Exception**: Unless you are building a selector for a list (such as list of profiles, list of pages, etc.) — in this case keep reading this guide (lists will be explained in the section[Lists: Incremental CSS Selectors](https://docs.zerowork.io/selectors/how-to-build-custom-selectors/lists-incremental-css-selectors.md)).

If the result does not show anything, your selector does not match any element or contains a typo. You need to try again, adjust it or build another one.

When you build your own selectors, always first check them with *document.querySelectorAll* directly on the website. This way you can avoid running your TaskBot every time you want to check validity of your custom built selector. It can save you some time.

{% hint style="warning" %}
Note that you cannot check correctness of `text=` (see [Selector Basics](https://docs.zerowork.io/selectors/selector-basics#find-an-element-by-its-text)) with *document.querySelectorAll* because this method is unique to ZeroWork.
{% endhint %}

### **Video Tutorial: Use document.querySelectorAll to Check Selector's Correctness and Uniqueness**

{% embed url="<https://youtu.be/hHAEaaxHEUI>" %}
