> 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/cookies/set_cookie.md).

# set\_cookie

## Syntax

```python
py.set_cookie(cookie: dict) -> None
```

## Usage

{% code title="correct usage" %}

```python
py.set_cookie({"name" : "foo", "value" : "bar"})
```

{% endcode %}

{% code title="incorrect usage" %}

```python
# Errors, 'set_cookie' accepts a single argument that is a Dict
py.set_cookie("foo", "bar")

---or---

# Errors, 'set_cookie' yields None
py.set_cookie({"name" : "foo", "value" : "bar"}).get_cookie()
```

{% endcode %}

## Arguments

* <mark style="color:purple;">`cookie (Dict)`</mark> - A dictionary with required keys: `"name"` and `"value"`

{% hint style="info" %}
Optional keys: `"path"`, `"domain"`, `"secure"`, `"expiry"`
{% endhint %}

## Yields

* None
