There are 2 methods to add cookies to a project, server-side cookies and client cookies.
Server-side Cookies
Client cookies are sent with a request as request headers. The server receiving the request can use these cookies to affect the content returned. In most cases a login cookie will need to be sent with the request, so the receiving server knows if it can return the logged in content or not.
Server side cookies are added via the Custom Request Headers function in Project Settings Step 4 > Advanced settings.
The name of the custom request header should be Cookie, with the cookie name/value pair in the request header value field, separated by a equals. e.g.
Requester Header Name: Cookie Request Header Value: cookie1=value1
Multiple cookie name value pairs can be added with a semi-colon separator. e.g.
Requester Header Name: Cookie Request Header Value: cookie1=value1; cookie2=value2
If you have multiple request headers called Cookie, they will be automatically merged when saved, and automatically split out into separate cookies when displayed in the project settings.
Client Cookies
Client cookies are populated into the headless browser before rendering begins. These are used to trigger effects on the front-end, such as not displaying a banner/pop-up
Client cookies are added via the Cookies setting in Project Settings Step 4 > Advanced settings.
There is an Import Cookies option where you can import all the cookies from a page where an action has already been completed, such as closing a cookie acceptance banner.
- Open the Dev tools console for any page with Command+Option+J on a Mac or Control+Shift+J in Windows/Linux.
- Type document.cookie to see a list of all cookies
- Copy this string to your clipboard by right clicking the cookie values and selecting 'Copy string contents'
- Paste the contents in into the Cookies import function and click Import. You should now see all the cookies as separate entries.
Notes
- Cookies may have a name but no value, or a value and no name.
- Cookies where the name begins with __secure- are set to HTTPonly. Otherwise no attributes are set.