Codebase list splinter / master docs / cookies.rst
master

Tree @master (Download .tar.gz)

cookies.rst @masterview markup · raw · history · blame

Cookies manipulation

It is possible to manipulate cookies using the cookies attribute from a Browser instance. The cookies attribute is a instance of a CookieManager class that manipulates cookies, like adding and deleting them.

Retrieve all cookies

To retrieve all cookies use the all method:

System Message: INFO/1 (<string>, line 33)

No directive entry for "highlight" in module "docutils.parsers.rst.languages.en". Trying "highlight" as canonical directive name.

System Message: ERROR/3 (<string>, line 33)

Unknown directive type "highlight".

.. highlight:: python

browser.cookies.all()

Delete all cookies

You can also delete all cookies: just call the delete method without any parameters:

System Message: INFO/1 (<string>, line 57)

No directive entry for "highlight" in module "docutils.parsers.rst.languages.en". Trying "highlight" as canonical directive name.

System Message: ERROR/3 (<string>, line 57)

Unknown directive type "highlight".

.. highlight:: python

browser.cookies.delete()  # deletes all cookies

For more details check the API reference of the :class:`CookieManager <splinter.cookie_manager.CookieManagerAPI>` class.

System Message: INFO/1 (<string>, line 63)

No role entry for "class" in module "docutils.parsers.rst.languages.en". Trying "class" as canonical role name.

System Message: ERROR/3 (<string>, line 63); backlink

Unknown interpreted text role "class".