Here are a few different ways to force Chrome into a “brand-new” session (i.e. no shared cookies, cache or logged-in state):
Use an Incognito window
• From the menu: ⋮ → “New Incognito window”
• Keyboard shortcut:
Windows/Linux: Ctrl + Shift + N
macOS: ⌘ + Shift + N
Launch Chrome with a fresh user-data directory
This gives you an entirely separate profile folder.
– On Windows (cmd.exe):
chrome.exe --user-data-dir="C:\Temp\ChromeSession1" --new-window
– On macOS (Terminal):
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
--user-data-dir="/tmp/chrome-session-1" --new-window
You can repeat with different folders (e.g. ChromeSession2, etc.) to spawn as many isolated sessions as you like.
In Selenium / WebDriver
If you’re automating Chrome and want each ChromeDriver instance to be a clean slate, specify a fresh user-data-dir at launch:
python
from selenium import webdriver
options = webdriver.ChromeOptions()
# opens in a new, empty profile
options.add_argument('--user-data-dir=/tmp/selenium-profile-1')
driver = webdriver.Chrome(options=options)
driver.get('https://www.google.com')
Or, if you just need “fresh cookies + no cache” but don’t care about isolation of extensions/profiles, you can launch in Incognito mode:
Multiple Chrome Profiles (UI)
Chrome’s built-in profile switcher lets you create totally distinct sessions, each with its own bookmarks, extensions, cookies, etc.:
Click your Profile icon (top right)
“Add” → choose a name & picture → “Add”
A new window opens in that profile
Pick whichever approach best matches your workflow (quick incognito test vs. fully isolated profile vs. Selenium automation). Let me know if you need more details on any of these! 😊
User
Can I use same profile/cookies?
Assistant
If you just want another Chrome window (not Incognito) that shares exactly the same cookies, history and logged-in state, you don’t need any special flags—Chrome will automatically open a new “normal” window in your current profile.
– On Windows/macOS/Linux:
• From the ⋮ menu → New Window
• Or click the Chrome icon again on your taskbar/dock
• Or from the command line just run chrome (or chrome.exe) with NO --user-data-dir argument: bash # e.g. Windows PowerShell & 'C:\Program Files\Google\Chrome\Application\chrome.exe'
This will detect the already-running Chrome and simply pop open a new window using your default profile.
—
If, however, you’re automating with Selenium/WebDriver and want your script to launch Chrome already “logged in” (i.e. reuse an existing profile’s cookies), here are three common patterns:
Launch ChromeDriver with your real user-data directory
(NOTE: all Chrome processes using that folder must be shut down first—Chrome locks the profile folder.)
python
from selenium import webdriver
opts = webdriver.ChromeOptions()
# point to your actual User Data folder:
opts.add_argument(r'--user-data-dir=C:\Users\YOU\AppData\Local\Google\Chrome\User Data')
# optionally specify a non-Default profile
# opts.add_argument('--profile-directory=Profile 1')
driver = webdriver.Chrome(options=opts)
driver.get('https://app.you-are-already-logged-in.com')
Attach to an already-running Chrome via remote debugging
Manually start Chrome once with chrome.exe --remote-debugging-port=9222 --user-data-dir="C:\MyProfile"
In Selenium:
python
from selenium import webdriver
opts = webdriver.ChromeOptions()
opts.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options=opts)
driver.get('https://your-site.com') # continues in that live session
Cookie “import/export”
If you can’t (or don’t want to) reuse the entire profile folder, you can
User
I need like 30 chromes with same cookies with different debugger addresses
Assistant
Below is a recipe for spawning N completely separate Chrome processes, each:
Starts with the same cookies/bookmarks/extensions/etc. (from your “template” profile)
Uses its own on-disk folder (so Chrome’s file-lock won’t bite you)
Exposes a unique --remote-debugging-port
You can adapt this to Windows, macOS or Linux; I’ll show a cross-platform Python example and then a bash/PowerShell sketch.
—
1) Create your “template” profile
Close ALL Chrome processes.
Launch Chrome pointing at an empty folder, e.g.:
bash
# on macOS / Linux
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--user-data-dir="/tmp/chrome-template"
# on Windows (PowerShell)
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' `
--user-data-dir="C:\temp\chrome-template"
In that window, log in to all the sites you care about, install extensions, etc.
Close Chrome. Now /tmp/chrome-template (or C:\temp\chrome-template) has exactly the cookies+state you want to replicate.
—
2) Python script to clone & launch 30 instances
python
import shutil, subprocess, sys, platform
from pathlib import Path
# 1) adjust these paths to point at your template & chrome binary
TEMPLATE = Path("/tmp/chrome-template") # or r"C:\temp\chrome-template"
CHROME_BIN = {
"Darwin": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"Linux": "/usr/bin/google-chrome",
"Windows": r"C:\Program Files\Google\Chrome\Application\chrome.exe"
}[platform.system()]
OUTDIR_BASE = Path("/tmp/chrome-instance-") # on Windows use r"C:\temp\chrome-instance-"
COUNT = 30
START_PORT = 9222
for i in range(COUNT):
dest = Path(f"{OUTDIR_BASE}{i}")
# 1) copy the entire template directory
if dest.exists():
shutil.rmtree(dest)
shutil.copytree(TEMPLATE, dest)
# 2) pick a unique debug port
port = START_PORT + i
# 3) launch Chrome
cmd = [
CHROME_BIN,
f"--user-data-dir={dest}",
f"--remote-debugging-port={port}",
"--no-first-run", # skip welcome screens
"--no-default-browser-check",
# "--start-maximized", # optional
# "--headless", # if you really want headless
]
# spawn without waiting
subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"Launched {COUNT} Chrome instances with ports {START_PORT} → {START_PORT+COUNT-1}")
User
Can I just load cookies / store profile in memory?
Assistant
You essentially have two “in-memory” strategies:
Don’t spin up 30 Chrome EXEs on disk at all, but instead run one Chrome and create 30 isolated “browser contexts” (incognito tabs) and inject your cookies into each.
Still launch N Chrome processes, but point each one at a RAM‐disk (tmpfs / imdisk / macOS RAM disk) so that the “profile” lives purely in memory.
Chrome’s DevTools Protocol (CDP) lets you create multiple BrowserContexts in a single browser process. Each context is like an incognito window, has its own cookie jar, cache, etc.—all in memory. You simply set your “template” cookies at startup:
Puppeteer example
js
const puppeteer = require('puppeteer');
const templateCookies = require('./cookies.json'); // export of page.cookies()
;(async () => {
// 1) Launch one Chrome
const browser = await puppeteer.launch({
headless: false,
args: ['--no-default-browser-check','--no-first-run'],
});
// 2) Spin up 30 contexts, set the same cookies, and navigate
for (let i = 0; i < 30; i++) {
const ctx = await browser.createIncognitoBrowserContext();
const page = await ctx.newPage();
// pre-inject cookies before any navigation
await page.setCookie(...templateCookies);
await page.goto('https://your-site.com');
console.log(`Context #${i} up at ${page.url()}`);
}
})();
In your fresh session B, driver.add_cookie(cookie_dict) for each saved cookie
Refresh/navigate—now you’ll be seen as “already logged in.”
—
Pick the approach that best fits your workflow:
• For manual testing = just open a new window (same profile, cookies & extensions).
• For one-off automation = cookie import/export.
• For full state reuse = user-data-dir or remote debugging.
Let me know if you hit any “profile in use” locks or need help stitching cookies into your script! 😊
—
3) What’s going on?
• You cannot point 30 Chrome processes all at once at the same user-data-dir. Chrome locks the folder.
• By copying your “template” folder into 30 separate folders, each Chrome sees your pre-baked cookies/login state, but file-locks its own copy.
• Each --remote-debugging-port gives you a unique WebSocket URL (ws://127.0.0.1:9222/devtools/...) for your automation tool of choice.
—
4) Mini-bash (Linux/macOS) or PowerShell (Windows) version
If you prefer one-liner loops:
bash (macOS/Linux):
bash
T=~/chrome-tmpl
B="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
for i in {0..29}; do
D=/tmp/chrome$i
rm -rf "$D" && cp -a "$T" "$D"
PORT=$((9222 + i))
"$B" --user-data-dir="$D" --remote-debugging-port=$PORT \
--no-first-run --no-default-browser-check &
done
—
That’s it! You now have 30 Chrome windows, all “logged in” exactly the same, each listening for DevTools on its own port.
Let me know if you run into any “profile in use” errors or need help wiring your automation framework (Puppeteer, Selenium, Playwright, …) into those ports. 🚀
Advantages
• All profiles live inside one Chrome process.
• Zero disk churn—everything is in memory.
• You don’t need 30 different --remote-debugging-ports; you connect once to the browser, then pick the context/page via CDP.
—
2) “Real” Chrome processes, but profile in RAM
If you really need 30 separate Chrome binaries (e.g. each with its own debugger‐port like --remote-debugging-port=9222), Chrome will still insist on a --user-data-dir. You can point that user-data-dir at a RAM-disk so it never hits SSD/HDD.
Linux (tmpfs)
bash
# create one big tmpfs mount for all your sessions
sudo mkdir /mnt/ramchrome
sudo mount -t tmpfs -o size=1G tmpfs /mnt/ramchrome
# then in your loop, just use:
for i in $(seq 0 29); do
DIR=/mnt/ramchrome/profile-$i
cp -a /path/to/chrome-template $DIR
PORT=$((9222+i))
google-chrome \
--user-data-dir="$DIR" \
--remote-debugging-port=$PORT \
--no-first-run \
--no-default-browser-check &
done
macOS (RAM disk)
bash
# create a 1 GB RAM disk
diskutil erasevolume HFS+ 'RAMDisk' \
$(hdiutil attach -nomount ram://$((2*1024*1024)))
# Suppose it mounts at /Volumes/RAMDisk
# then replicate & launch:
for i in {0..29}; do
DIR=/Volumes/RAMDisk/profile-$i
cp -a ~/chrome-template "$DIR"
PORT=$((9222+i))
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--user-data-dir="$DIR" \
--remote-debugging-port=$PORT \
--no-first-run \
--no-default-browser-check &
done
Windows (ImDisk or third-party RAM-disk)
Create a RAM-disk (e.g. with ImDisk) at R:\ of sufficient size.
In PowerShell, copy your template profile to R:\profile0…profile29 and launch with each --user-data-dir=R:\profileN and --remote-debugging-port=9222+N.
—
Which to pick?
• If your only goal is “30 truly separate cookie-jars” but you don’t actually need 30 different Chrome executables or ports, the single-Chrome + 30 incognito contexts approach is super lightweight and entirely in RAM.
• If you specifically need 30 different --remote-debugging-port endpoints (e.g. for 30 parallel Selenium/Playwright drivers), then you’ll have to give each one a distinct --user-data-dir. Putting those dirs on a RAM‐disk makes them “in memory” only, but you still pay the copy cost at startup.
Let me know which path you’d like to explore further! 🙏🏻🚀