Skip to main content

Cookies and Storage

Sometimes tests require to handle cookies and web storage. Read on to learn how to work with them.

Working with cookies#

# add a cookieaddCookie('some-cookie', '1118;accepted', '/', 'example.com', 365*24*60*60*1000, true)
# get a cookiecookie = getNamedCookie('some-cookie')
# delete a cookiedeleteCookie('some-cookie')

See Cookies Api Reference for all available functions.

Working with storage#

  • Local storage

    # set an itemlsSetItem('some-key', "1232")
    # get all keys as listkeyList = lsGetKeySet()
    # get value by keyvalue = lsGetItem('some-key')
    # remove item by keylsRemoveItem('some-key')
    # get total items in storagelsSize()
    # clear local storagelsClear()
  • Session storage

    # set an itemssSetItem('some-key', "1232")
    # get all keys as listkeyList = ssGetKeySet()
    # get value by keyvalue = ssGetItem('some-key')
    # remove item by keyssRemoveItem('some-key')
    # get total items in storagessSize()
    # clear session storagessClear()