Working with Cookies in Browser Automation Studio
How to save, load and manage cookies in BAS — persisting logins across runs, moving sessions between profiles, and avoiding the mistakes that get accounts logged out.
Cookies are how a website remembers you’re logged in. In BAS, mastering cookies is what turns a bot that logs in every single run into one that restores a session instantly — and it’s the foundation of stable multi-account work.
What cookies do in BAS
After you log in, the site stores session cookies in the browser. BAS lets you export those cookies to a string or file, and import them later to restore the exact session. Done right, a saved cookie set means the bot lands already authenticated, skipping the login (and any captcha) entirely.
Save cookies after login
The pattern is: log in once, confirm success, then save the cookies. Store them keyed to the account they belong to — a file per account, or a field in your account database. This snapshot is the account’s session; treat it as valuable data.
Load cookies before navigating
Order matters. On the next run, load the cookies first, then navigate to the site. If you navigate before loading, the browser establishes a fresh anonymous session and your cookies arrive too late. Load → navigate → verify you’re logged in.
Keep the session consistent
A cookie set is tied to the identity that created it. Sites cross-check the session against the network and browser it sees, so:
- Pin the proxy. Loading an account’s cookies from a wildly different IP looks like a hijack and gets the session killed.
- Pin the fingerprint. A different browser fingerprint on the same session is another red flag.
- Never mix accounts. One account’s cookies in another account’s profile corrupts both.
Consistency across cookies, proxy and fingerprint is what keeps accounts alive.
Refresh and validate
Sessions expire. Build your flow to validate the restored session — check for a logged-in indicator after loading. If it’s invalid, fall back to a full login and re-save the fresh cookies. This self-healing loop keeps a fleet of accounts logged in over weeks without manual babysitting.
Clearing cookies on purpose
Sometimes you want the opposite — a clean slate. Clearing cookies (and other storage) before starting gives you a fresh anonymous browser, which is what you want when registering new accounts so no previous session leaks in.
Cookies handle the session side of identity; the browser side — fingerprint and user-agent — is the next article in this guide.
FAQ
How do I keep a BAS bot logged in between runs?
Save the cookies after a successful login, store them per account, and load them at the start of the next run before navigating. A valid cookie set restores the session without logging in again.
Why does my account log out even though I load cookies?
Common causes: loading cookies after navigation instead of before, mixing cookies between accounts, or changing the IP/fingerprint so the site invalidates the session. Keep cookies, proxy and fingerprint consistent per account.
- Browser Automation Studio: The Complete Practical GuideGuide
- Building Your First Bot in Browser Automation StudioA step-by-step walkthrough of creating your first working BAS bot — from a blank project to a flow that navigates, extracts data, and runs in multiple threads.
- Setting Up Proxies in Browser Automation StudioHow to configure proxies in BAS the right way — proxy types, per-thread assignment, rotation, and the checks that keep multi-account bots from getting flagged.
- Finding Elements in BAS: Selectors That Don't BreakHow element search works in Browser Automation Studio — CSS vs XPath selectors, why recorded ones break, and how to write selectors that survive page changes.