Working with Cookies

Cookies overview

Cookies are a type of message given to a web browser by a web server. They aim to identify users and potentially prepare customized web pages to prevent the user from having to re-enter information.

Why are they useful?

Cookies essentially customize your web experience! For example, if you visit an online shop for the first time, the site's server sends a file to your computer and automatically installs this file on your machine. As a result, you'll be recognized as returning visitor the next time you visit the website, and you won't have to re-enter your information.

How many kinds of cookies are there?

There are three main types of cookies: session, permanent, and third-party cookies. Session cookies are primarily used by online shops, and expire when the browser is closed. Permanent cookies are the kind that remain in operation even after closing the browser. They remember your anonymous user ID or login credentials so you can be easily identified and/or authenticated every time you visit a site. There are also third-party cookies, which are installed by external parties that collect certain user information on demographics and behavior.

You can now use the mabl Trainer to set cookies and then create assertions against cookie attributes. Please use the following steps as a guide to doing so.

How to set a cookie

  1. Click on the "More Actions" icon in the bottom toolbar.
  1. Click on the option to 'Manage Cookies'.

You'll see this popup.

Options - managing cookies

Options - managing cookies

  1. Click on the option to Set Cookie, and fill out the name and value. Click "Save".

Verifying Cookies with assertions

  1. Create a new assertion from the assertions menu.
Adding assertions

Adding assertions

  1. Choose the option to assert against a Cookie.
  2. Select a cookie from the drop-down menu to view its attributes. The trainer will automatically populate this drop-down with a list of all cookies that are associated with the current page.
Choose to assert against "Cookie"

Choose to assert against "Cookie"

Selecting a cookie

Selecting a cookie

  1. Review the assertion properties, and modify if needed. Click "Save".
  1. You'll now see a step in your test containing the cookie assertion.

Adding assertion steps

You can add assertions only when creating or editing a test in the mabl Trainer. See Defining a test with the mabl trainer and Including assertions in your test for more information. Assertions cannot be added in quick-edit mode.

Working with Cookies


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.