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.
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.
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.
- Click on the "More Actions" icon in the bottom toolbar.
- Click on the option to 'Manage Cookies'.
You'll see this popup.
Options - managing cookies
- Click on the option to Set Cookie, and fill out the name and value. Click "Save".
- Choose the option to assert against a Cookie.
- 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"
Selecting a cookie
- Review the assertion properties, and modify if needed. Click "Save".
- You'll now see a step in your test containing the cookie assertion.