Skip to content

[Bug]: headless=True causes a session loss with launch_persistent_context #2926

@MarvellousBee

Description

@MarvellousBee

Version

Version: 1.54.0

Steps to reproduce

  1. Clone my repo at https://github.com/MarvellousBee/playwright-python-headless-session-bug
  2. pip install -r requirements.txt
  3. python example.py
  4. DO NOT PRESS 'ENTER' YET! Log into your GitHub account. This works with other websites too.
  5. Once you are logged in, press Enter.
  6. Your browser will close and you should see another browser pop up.
  7. 2nd browser should have you logged in automatically, because I used launch_persistent_context to store your session. This is just for demonstration purposes. Press Enter again to close the browser.
  8. 3rd browser is in headless mode. You should see that you got redirected to the login page, despite using the same session:
#3 (Headless login fails!)
Got redirected to: https://github.com/login?...
Press Enter to continue...
  1. Press Enter to launch the final browser, without headless mode. You are logged out now!

Expected behavior

I expect the session to persist when i enable headless mode. I expected browser 3. and 4. to keep me logged in.

Actual behavior

The session is lost when browser 3. launches with headless=True.

Additional context

I'm aware that actual behavior might be expected behavior here, so is it possible to modify the code to get my expected behavior in this situation?

Environment

- Operating System: [Windows 11]
- CPU: [x86_64]
- Browser: [Chromium]
- Python Version: [3.10.6]
- Other info:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy