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 "Insert step" plus icon in the bottom toolbar.
  2. Click on the 'Cookies' option.
  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 button at the bottom of the page.
  2. Choose the option to assert against a Cookie.
  3. 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"

Choose to assert against "Cookie"

Selecting a cookieSelecting a cookie

Selecting a cookie

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

Watch the next chapter in the quick start video guide.

Did this page help you?