Playwright headed browser does not run via VS Code Remote SSH but works via MobaXterm X11 forwarding

Subbu Ayyanar 0 Reputation points
2026-08-28T04:57:06.3566667+00:00

We are using a Playwright environment hosted on a remote RHEL server and connecting to it using VS Code Remote SSH.

When attempting to execute Playwright tests in headed mode from VS Code Remote SSH, the browser fails to start and reports that no display is available:

pw: --headed needs a display, and none is available.

Connect with ssh -X or ssh -Y, or drop the flag to run headless.

However, headed browser execution works successfully when connecting to the same server through MobaXterm using an alternative configuration provided by our infrastructure team.

This suggests that:

  • Playwright is installed correctly.
  • Browser binaries are installed correctly.
  • The remote server is capable of launching headed browsers.
  • A graphical display can be made available under certain connection methods.

The issue appears to be specific to running headed Playwright browsers from VS Code Remote SSH.

We would like guidance on:

  1. Whether VS Code Remote SSH supports graphical applications using X11 forwarding on Linux hosts.
  2. Whether additional VS Code Remote SSH configuration is required.
  3. Any known limitations when running Playwright headed browsers via VS Code Remote SSH.
  4. Recommended configuration to achieve behaviour similar to the working MobaXterm setup.

Environment:

  • VS Code Remote SSH
  • RHEL server
  • Playwright
  • Remote Docker/Playwright container
  • MobaXterm (headed browser works)

Any guidance would be appreciated.However, headed browser execution works successfully when connecting to the same server through MobaXterm using an alternative configuration provided by our infrastructure team.

This suggests that:

  • Playwright is installed correctly.
  • Browser binaries are installed correctly.
  • The remote server is capable of launching headed browsers.
  • A graphical display can be made available under certain connection methods.

The issue appears to be specific to running headed Playwright browsers from VS Code Remote SSH.

We would like guidance on:

  1. Whether VS Code Remote SSH supports graphical applications using X11 forwarding on Linux hosts.
  2. Whether additional VS Code Remote SSH configuration is required.
  3. Any known limitations when running Playwright headed browsers via VS Code Remote SSH.
  4. Recommended configuration to achieve behaviour similar to the working MobaXterm setup.

Environment:

  • VS Code Remote SSH
  • RHEL server
  • Playwright
  • Remote Docker/Playwright container
  • MobaXterm (headed browser works)

Any guidance would be appreciated.

Developer technologies | Visual Studio | Setup
0 comments No comments

2 answers

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 8,535 Reputation points Microsoft External Staff Moderator
    2026-08-28T08:28:20.4633333+00:00

    Hi @Subbu Ayyanar ,

    Thanks for laying out the details so clearly. The difference comes down to MobaXterm having its own built-in X server and setting things up for you automatically. VS Code Remote - SSH doesn't do that on its own, so nothing gets set for the display and Playwright reports there's none available. This is a known limitation of the extension, tracked in vscode-remote-release#267.

    To get the same behaviour as MobaXterm:

    1. Run an X server on your Windows machinehttps://sourceforge.net/projects/vcxsrv/ or Xming. In XLaunch, tick "Disable access control".

    2. Set DISPLAY on Windows before launching VS Code. This step is easy to miss, and the connection won't reach your X server without it:

    Close and reopen VS Code afterwards.

    3. Add forwarding to your local ~/.ssh/config:

    4. Check it on the remote side. In the VS Code terminal, run echo $DISPLAY. You should see something like localhost:10.0 — forwarded displays start at 10, not 0. If it comes back empty, open a normal ssh -X session to the same server, run echo $DISPLAY there, and export that same value in your VS Code terminal:

    If you'd rather not do this by hand, the Remote X11 and Remote X11 (SSH) extensions handle the forwarding and set DISPLAY for you. They only work with public key authentication, so that may or may not fit your setup.

    A couple of things worth knowing: X11 over SSH will feel slower than what you're used to, and you may need to re-export $DISPLAY in new terminal tabs.

    One question before you go further — are the tests running directly on the RHEL host, or inside the Playwright container? You mentioned both, and the answer changes things. If it's the container, X11 forwarding won't reach inside it, and xvfb-run npx playwright test --headed is a much simpler route since it creates a virtual display with no forwarding needed.

    If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.

    Thank you

    Was this answer helpful?

    0 comments No comments

  2. Danny Nguyen (WICLOUD CORPORATION) 8,535 Reputation points Microsoft External Staff Moderator
    2026-08-28T07:22:22.8266667+00:00

    I'm looking into this issue and will get back to you soon. Thank you for your patience.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.