> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dendrite.systems/llms.txt
> Use this file to discover all available pages before exploring further.

# Element

> Interact with web elements using natural language

The `Element` class represents an element in the Dendrite browser environment. It wraps a Playwright Locator and provides methods for interacting with and manipulating elements in the browser.

## Methods

### outer\_html

Retrieves the outer HTML of the element.

#### Usage

```python theme={null}
html = await element.outer_html()
```

#### Returns

* `str`: The outer HTML of the element.

### screenshot

Takes a screenshot of the element and returns it as a base64-encoded string.

#### Usage

```python theme={null}
screenshot = await element.screenshot()
```

#### Returns

* `str`: A base64-encoded string of the JPEG image. Returns an empty string if the screenshot fails.

### click

Clicks the element.

#### Usage

```python theme={null}
await element.click(expected_outcome="The dropdown menu should open")
```

#### Arguments

* `expected_outcome` (Optional\[str]): The expected outcome of the click action.
* `*args`: Additional positional arguments.
* `**kwargs`: Additional keyword arguments.

#### Returns

* `InteractionResponse`: The response from the interaction.

### fill

Fills the element with a value.

#### Usage

```python theme={null}
await element.fill("John Doe", expected_outcome="The input field should contain the entered name")
```

#### Arguments

* `value` (str): The value to fill the element with.
* `expected_outcome` (Optional\[str]): The expected outcome of the fill action.
* `*args`: Additional positional arguments.
* `**kwargs`: Additional keyword arguments.

#### Returns

* `InteractionResponse`: The response from the interaction.

### hover

Hovers over the element.

#### Usage

```python theme={null}
await element.hover(expected_outcome="A tooltip should appear")
```

#### Arguments

* `expected_outcome` (Optional\[str]): The expected outcome of the hover action.
* `*args`: Additional positional arguments.
* `**kwargs`: Additional keyword arguments.

#### Returns

* `InteractionResponse`: The response from the interaction.

### highlight

Highlights the element for debugging purposes.

#### Usage

```python theme={null}
await element.highlight()
```

This method is useful for visually identifying elements during development and debugging.
