{
  "id": 17401840,
  "title": "Isolando sessões de navegador com Playwright em Python (a ideia por trás dos perfis antidetect)",
  "url": "https://urgent.news/2026/10/31/isolando-sessoes-de-navegador-com-playwright-em-python-a-ideia-por",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-31T12:32:28.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/nuvemdev/isolando-sessoes-de-navegador-com-playwright-em-python-a-ideia-por-tras-dos-perfis-antidetect-46l4"
  },
  "original_language": "pt",
  "account": "Local vendors often run multiple accounts on platforms like shops, ads, or marketplaces. When using a single browser like Chrome, cookies and login information get mixed together. An antidetect browser resolves this issue with isolated profiles. You can grasp the concept in just 20 lines of Python.\n\nTo begin, launch two profiles using Playwright, each with its own cookies, language, timezone, user agent, and screen resolution. Confirm that one profile cannot see the other.\n\nInstall Playwright by running `pip install playwright` and then install Chromium with `playwright install chromium`. The code is as follows:\n\n```python\nfrom playwright.sync_api import sync_playwright\n\nwith sync_playwright() as p:\nb = p.chromium.launch()\na = b.new_context(\nuser_agent=\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/124 Safari/537.36\",\nlocale=\"pt-BR\",\ntimezone_id=\"America/Sao_Paulo\",\nviewport={\"width\": 1366, \"height\": 768}\n)\nc = b.new_context(\nuser_agent=\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) Chrome/124 Safari/537.36\",\nlocale=\"en-US\",\ntimezone_id=\"America/New_York\",\nviewport={\"width\": 1440, \"height\": 900}\n)\n\nfor name, ctx in ((\"A\", a), (\"B\", c)):\npg = ctx.new_page()\nctx.add_cookies([\n{\n\"name\": \"conta\",\n\"value\": name,\n\"url\": \"http://localhost:8765\"\n}\n])\npg.goto(\"http://localhost:8765\")\nprint(name, pg.evaluate(\"[navigator.language, Intl.DateTimeFormat().resolvedOptions().timeZone, screen.width]\"), [x[\"value\"] for x in ctx.cookies()])\n\nb.close()\n```\n\nBefore running the code, start a local server, such as `python3 -m http.server 8765`. The output should look like this:\n\n```\nA ['pt-BR', 'America/Sao_Paulo', 1366] ['A']\nB ['en-US', 'America/New_York', 1440] ['B']\n```\n\nEach context has its own cookies and identity, with no one seeing the other's information. This solution provides basic isolation. A true antidetect browser handles dozens of signals, such as canvas, WebGL, and fonts, and allows you to open profiles through an interface without writing code. However, keep in mind that no tool authorizes violating platform rules. Many shops prohibit duplicate accounts, so always read their terms. If you don't want to code, consider GoLogin, which offers a free plan with 3 profiles and 7 days of testing. Check their pricing page here: https://go.nowto.link/gologin. For more content in Portuguese, visit my newsletter: https://nuvemdev.substack.com. Some links are affiliate links: if you purchase, I may earn a commission with no extra cost to you.",
  "summary": "Quem vende online acaba com várias contas abertas: loja, anúncios, marketplace. No mesmo Chrome, cookie e login se misturam. Navegador antidetect resolve isso com perfis isolados. Dá pra entender a ideia em 20 linhas de Python. O que vamos fazer Abrir dois \"perfis\" com Playwright, cada um com cookies, idioma, fuso, user agent e tela próprios, e confirmar que um não enxerga o outro. Instalação pip…",
  "key_points": [
    "Install Playwright with pip install playwright and Chromium with playwright install chromium",
    "Create two isolated browser contexts with different user agent, locale, timezone, and viewport",
    "Each context has its own cookies and identity, preventing information leakage"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}