> 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-selectors/how-to-build-custom-selectors/basic-concepts-of-selectors.md).

# Basic Concepts of Selectors

Let's take the search button from the Wikipedia website as an example.&#x20;

For the record, for a website like Wikipedia it's fully sufficient to simply copy selectors, as described here: [Copy Selectors](/using-zerowork/using-selectors/copy-selectors.md). Building custom selectors is only needed if you create TaskBots for "tricky" websites such as social media. We are just using Wikipedia as an example to explain the basic concepts and the way of building your own CSS selectors.

Open your console by right-clicking on the search icon as shown below and then click on *Inspect*.

![](/files/aoO7CewTWQl0XWvDYnVX)

Now let's zoom in on the highlighted element on the right:

![](/files/rWxVX1P7BqX1r4B6qtT1)

#### **Tag**

Every CSS selector has a tag. Examples can be *div*, *a*, *main*, *li*, etc. It's the first word that is marked purple (see picture above).&#x20;

For Wikipedia's search button, the tag is ***button***.&#x20;

![](/files/DpoLfKhbyQoQRGKWEcOQ)

#### **Attributes**

Most CSS selectors have several attributes such as *class*, *id*, *aria-label*, etc. One selector can have one, many or no attributes. Attributes are marked brown (see picture above).

For Wikipedia's search button, the attributes are ***class*** and ***type.***&#x20;

![](/files/b50vs9aSOTrLAzgSlFJG)

#### **Value**

Inside the attributes there is a value.

For Wikipedia's search button, the value inside of ***class*** is *pure-button pure-button-primary-progressive* and the value inside of ***type*** is *submit*.

![](/files/zKZ0uuqBP1BmLZujix1a)

### **Building a Selector**

To build a selector, you need to adhere to this structure:

<mark style="background-color:yellow;">tag\[attribute='value']</mark>

Note that there is no space between tag and attribute in square brackets. Note that the value is wrapped in quotes.

Or, if your element has several attributes, then the structure can be:

<mark style="background-color:yellow;">tag\[attribute1='value']\[attribute2='value']</mark>

So for Wikipedia's search button in the above example, the selector would look like this:

<mark style="background-color:yellow;">button\[class='pure-button pure-button-primary-progressive']\[type='submit']</mark>

### **Video Tutorial: Basic Concepts**

{% embed url="<https://youtu.be/-W-ug4g_wjY>" %}


---

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zerowork.io/using-zerowork/using-selectors/how-to-build-custom-selectors/basic-concepts-of-selectors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
