# 4.2. Locator Table

| **Category**  | **Recipe**                                            | **XPath**                   |   **CSS**   |   |
| ------------- | ----------------------------------------------------- | --------------------------- | :---------: | - |
| **General**   | Whole web page                                        | `/html`                     |    `html`   |   |
|               | Whole web page body                                   | `/html/body`                |    `body`   |   |
| **Tag**       | Element  by relative reference                        | `//E`                       |     `E`     |   |
|               | Second  element anywhere on page                      | `(//E)[2]`                  |     `NA`    |   |
|               | Element  with attribute A                             | `//E[@A]`                   |    `E[A]`   |   |
|               | Element  with attribute A containing text 't' exactly | `//E[@A='t']`               |  `E[A='t']` |   |
|               | Element  with attribute A containing text 't'         | `//E[contains(@A,'t')]`     |     `NA`    |   |
| **Id & Name** | Element  \<E> with id I                               | `//E[@id='I']`              |    `E#I`    |   |
|               | Element with id I                                     | `//*[@id='I']`              |     `#I`    |   |
|               | Element \<E> with name N                              | `//E[@name='N']`            | `E[name=N]` |   |
|               | Element with name N                                   | `//*[@name='N']`            |  `[name=N]` |   |
| **Class**     | Element  \<E> with class C                            | `//E[@class='C']`           |    `E.C`    |   |
| **Text**      | Element \<E> containing text t exactly                | `//E[.='t']`                |     `NA`    |   |
|               | Element \<E> containing text t                        | `//E[contains(text(),'t')]` |     `NA`    |   |


---

# Agent Instructions: 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:

```
GET https://tvn.gitbook.io/selenium-java/locator-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
