-4

The authentication cookies ARE present in the browser (as shown in dev tools), but Playwright isn't capturing them properly. Is this a common issue with how Playwright handles cookie contexts?

The Problem:

In dev tools, one can see auth cookies

But in the saved cookies, we only get:
GAESA, _dd_s (non-auth cookies)
Cloudflare cookies (cf_clearance, __cf_bm)

Any way out ?

The underlying/background problem is that Playwright does not connect to the already opened/running browser under a certain port but rather opens a new browser thus missing existing context, cookies:

for i, (port, path, name) in enumerate(zip(config["ports"], config["paths"], config["names"])):
# Create server thread
server_thread = threading.Thread(target=run_server, args=(port, path))
servers.append(server_thread)

# Create browser automation thread
browser_url = f"ws://localhost:{port}/{path}"
browser_thread = threading.Thread(
    target=automate_browser, 
    args=(browser_url, name)
)
browser_automations.append(browser_thread)
1
  • A minimal reproducible example is needed here. You wrote "The underlying problem is" but might not have finished your thought. Commented 12 hours ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.