> 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/element-commands/actions/select_many-1.md).

# select\_by\_value

## Syntax

```python
Element.select_by_value(value: Any) -> Element
```

## Usage

{% code title="correct usage" %}

```python
py.get("#dropdown").select_by_value(2)

---or--- # chain an Element command

py.get("#dropdown").select_by_value("1").get_attribute("value")
```

{% endcode %}

{% code title="incorrect usage" %}

```python
# Errors, can only perform this command on a <select> dropdown element
py.get("ul > li").select_by_value("2")
```

{% endcode %}

## Arguments

* <mark style="color:purple;">`value (Any)`</mark> - The **value** of the option to select. Usually a `str`, but can be other types.

## Yields

* <mark style="color:orange;">**Element**</mark> - The current instance of Element so you can chain commands.

## Examples

Given this HTML

```html
<select id="dropdown">
    <option value="" disabled="disabled" selected="selected">Please select an option</option>
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
</select>
```

We can select any of the options

```python
dropdown = py.get("dropdown")

# Select the first option that is "disabled"
dropdown.select_by_value("")

# Select Option 1
dropdown.select_by_value("1")

# Select Option 2
dropdown.select_by_value("2")
```

{% hint style="info" %}
Give this a try yourself! <https://the-internet.herokuapp.com/dropdown>
{% endhint %}

## See also

* [select\_*by\_*&#x69;ndex](/element-commands/actions/select.md)&#x20;
* [select\_*by\_*&#x74;ext](/element-commands/actions/select_many.md)
* [click()](/element-commands/actions/click.md) - If the dropdown is NOT a \<select> element, <mark style="color:purple;">`.click()`</mark> will work
