Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright starts browser in headed mode when called from VS Code Debugger - even on headless server #122

Open
pearzt opened this issue Jul 21, 2022 · 2 comments

Comments

@pearzt
Copy link

pearzt commented Jul 21, 2022

The current implementation starts the browser in headed mode automatically, if pytest is invoked from VS Code's debugger.

elif VSCODE_PYTHON_EXTENSION_ID in sys.argv[0] and _is_debugger_attached():
# When the VSCode debugger is attached, then launch the browser headed by default
launch_options["headless"] = False

While I get the idea behind this, it does not take remote development on a headless server into account. If $DISPLAY is not set, the test run naturally fails and leaves the user wondering why this happens because he did not provide --headed (e.g. in VS Code's python.testing.pytestArgs configuration). IMHO, the implementation should be changed to check for $DISPLAY at least.

@rwoll rwoll added the bug Something isn't working label Jul 22, 2022
@rwoll rwoll assigned rwoll and unassigned rwoll Jul 22, 2022
@rwoll rwoll added triaging and removed bug Something isn't working labels Jul 22, 2022
@Sparrow0hawk
Copy link

Had this issue today when using VSCode Python Extension (v2023.14.0) Test debugger in WSL2.

Worked around it by changing the above setting but be great to know if this could be more configurable.

@mxschmitt
Copy link
Member

Happy to accept patches about this to include an if with something like:

no_supported_display = sys.platform == "linux" and os.getenv("DISPLAY")
elif VSCODE_PYTHON_EXTENSION_ID in sys.argv[0] and _is_debugger_attached() and not no_supported_display`: 

(just put it quickly there, might need different conditions etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants