> For the complete documentation index, see [llms.txt](https://docs.pylenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pylenium.io/driver-commands/find-elements/find.md).

# find

## Syntax

```python
py.find(css: str) -> Elements
py.find(css: str, timeout: int) -> Elements

---or---

Element.find(css: str) -> Elements
Element.find(css: str, timeout: int) -> Elements
```

## Usage

{% code title="correct usage" %}

```python
# Yield Elements in .nav with tag name of a
py.get(".nav").find("a")

---or---

# Yield all Elements in the DOM with id of 'button'
py.find("#button")

---or--- # store in a variable

elements = py.find("li")

---or--- # chain an Elements command

element = py.find("ul > li").first()

---or--- # control the timeout in any of the above usages

py.find("li", timeout=5).last()
```

{% endcode %}

{% code title="incorrect usage" %}

```python
# Errors, 'title' does not yield Element
py.title.find("QAP")

---or---

# Errors, 'get_cookie' does not yield Element
py.get_cookie().find("Cooke Monster")
```

{% endcode %}

## Arguments

* `css (str)` - The CSS selector to use
* `timeout=None (int)` - The number of seconds for this command to succeed.
  * <mark style="color:purple;">`timeout=None`</mark> will use the default <mark style="color:orange;">**wait\_time**</mark> in [pylenium.json](/configuration/pylenium-json.md)
  * <mark style="color:purple;">`timeout=0`</mark> will poll the DOM immediately with no wait
  * Greater than zero will *override* the default <mark style="color:orange;">**wait\_time**</mark>

## Yields

* <mark style="color:orange;">**Elements**</mark> - A list of elements that match the query.

## Examples

```python
# If you expect the elements not to be present
assert py.find("ul > li").should().be_empty()

# Otherwise, just use the default
elements = py.find("ul > li")
```


---

# 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.pylenium.io/driver-commands/find-elements/find.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.
