|
| def | add_cookie (self, name, value, path=None, domain=None, secure=None, expiry=None) |
| | Adds a cookie to your current session. More...
|
| |
| def | delete_all_cookies (self) |
| | Deletes all cookies. More...
|
| |
| def | delete_cookie (self, name) |
| | Deletes cookie matching name. More...
|
| |
| def | get_cookie (self, name) |
| | Returns information of cookie with name as an object. More...
|
| |
| def | get_cookies (self, as_dict=False) |
| | Returns all cookies of the current page. More...
|
| |
| def | assert_page_contains (self, locator, tag=None, message=None, loglevel='TRACE') |
| |
| def | assert_page_not_contains (self, locator, tag=None, message=None, loglevel='TRACE') |
| |
| def | debug (self, msg, html=False) |
| |
| def | get_timeout (self, timeout=None) |
| |
| def | info (self, msg, html=False) |
| |
| def | log (self, msg, level='INFO', html=False) |
| |
| def | log_source (self, loglevel='INFO') |
| |
| def | warn (self, msg, html=False) |
| |
| def | __init__ (self, ctx) |
| | Base class exposing attributes from the common context. More...
|
| |
| def | find_element (self, locator, tag=None, required=True, parent=None) |
| | Find element matching locator. More...
|
| |
| def | find_elements (self, locator, tag=None, parent=None) |
| | Find all elements matching locator. More...
|
| |
| def | is_element_enabled (self, locator, tag=None) |
| |
| def | is_text_present (self, text) |
| |
| def | is_visible (self, locator) |
| |
Definition at line 27 of file cookie.py.
| def SeleniumLibrary.keywords.cookie.CookieKeywords.add_cookie |
( |
|
self, |
|
|
|
name, |
|
|
|
value, |
|
|
|
path = None, |
|
|
|
domain = None, |
|
|
|
secure = None, |
|
|
|
expiry = None |
|
) |
| |
Adds a cookie to your current session.
``name`` and ``value`` are required, ``path``, ``domain``, ``secure``
and ``expiry`` are optional. Expiry supports the same formats as
the [http://robotframework.org/robotframework/latest/libraries/DateTime.html|DateTime]
library or an epoch time stamp.
Example:
| `Add Cookie` | foo | bar | |
| `Add Cookie` | foo | bar | domain=example.com |
| `Add Cookie` | foo | bar | expiry=2027-09-28 16:21:35 | # Expiry as timestamp. |
| `Add Cookie` | foo | bar | expiry=1822137695 | # Expiry as epoch seconds. |
Prior to SeleniumLibrary 3.0 setting expiry did not work.
Definition at line 131 of file cookie.py.
| def SeleniumLibrary.keywords.cookie.CookieKeywords.get_cookie |
( |
|
self, |
|
|
|
name |
|
) |
| |
Returns information of cookie with name as an object.
If no cookie is found with ``name``, keyword fails. The cookie object
contains details about the cookie. Attributes available in the object
are documented in the table below.
| = Attribute = | = Explanation = |
| name | The name of a cookie. |
| value | Value of the cookie. |
| path | Indicates a URL path, for example ``/``. |
| domain | The domain the cookie is visible to. |
| secure | When true, cookie is only used with HTTPS connections. |
| httpOnly | When true, cookie is not accessible via JavaScript. |
| expiry | Python datetime object indicating when the cookie expires. |
| extra | Possible attributes outside of the WebDriver specification |
See the
[https://w3c.github.io/webdriver/#cookies|WebDriver specification]
for details about the cookie information.
Notice that ``expiry`` is specified as a
[https://docs.python.org/3/library/datetime.html#datetime.datetime|datetime object],
not as seconds since Unix Epoch like WebDriver natively does.
In some cases, example when running browser in the cloud, it is possible that
cookie contains other attributes than is defined in the
[https://w3c.github.io/webdriver/#cookies|WebDriver specification].
These other attributes are available in a ``extra`` attribute in the cookie
object and it contains a dictionary of the other attributes. The ``extra``
attribute is new in SeleniumLibrary 4.0.
Example:
| `Add Cookie` | foo | bar |
| ${cookie} = | `Get Cookie` | foo |
| `Should Be Equal` | ${cookie.name} | bar |
| `Should Be Equal` | ${cookie.value} | foo |
| `Should Be True` | ${cookie.expiry.year} > 2017 |
New in SeleniumLibrary 3.0.
Definition at line 109 of file cookie.py.
| def SeleniumLibrary.keywords.cookie.CookieKeywords.get_cookies |
( |
|
self, |
|
|
|
as_dict = False |
|
) |
| |
Returns all cookies of the current page.
If ``as_dict`` argument evaluates as false, see `Boolean arguments`
for more details, then cookie information is returned as
a single string in format ``name1=value1; name2=value2; name3=value3``.
When ``as_dict`` argument evaluates as true, cookie information
is returned as Robot Framework dictionary format. The string format
can be used, for example, for logging purposes or in headers when
sending HTTP requests. The dictionary format is helpful when
the result can be passed to requests library's Create Session
keyword's optional cookies parameter.
The `` as_dict`` argument is new in SeleniumLibrary 3.3
Definition at line 57 of file cookie.py.