Menu

Remote Access and Debugging

Relevant source files

Purpose and Scope

This page documents the remote access and debugging infrastructure for browser sessions running in Selenium Grid containers. It covers the VNC server setup, noVNC web-based access, Fluxbox window manager configuration, and Supervisor process management that enables live viewing of browser automation sessions.

For information about video recording of sessions, see Video Recording and Upload. For container startup and lifecycle management, see Component Startup and Lifecycle.

Overview

Remote access capabilities allow developers and operators to view live browser sessions running inside Docker containers. This is essential for debugging test failures, understanding automation behavior, and troubleshooting issues in both development and production environments.

The remote access stack consists of four integrated components:

  • Xvfb: Virtual framebuffer providing a headless X11 display
  • x11vnc: VNC server exposing the virtual display over the network
  • noVNC: Web-based VNC client for browser access without additional software
  • Fluxbox: Lightweight window manager providing basic desktop functionality

All components are orchestrated by Supervisor, which manages process lifecycle, dependencies, and automatic restarts.

Architecture

Sources: NodeBase/Dockerfile81-161 NodeBase/selenium.conf1-73

Component Details

Xvfb (X Virtual FrameBuffer)

Xvfb creates a virtual X11 display server that performs all graphical operations in memory without requiring a physical display. This enables browsers to run in headless environments while still rendering full GUI elements.

Key Configuration:

  • Display number: 99 (environment variable DISPLAY_NUM)
  • Display identifier: :99.0 (environment variable DISPLAY)
  • Screen resolution: 1920x1080x24 by default
  • Configurable via SE_SCREEN_WIDTH, SE_SCREEN_HEIGHT, SE_SCREEN_DEPTH, SE_SCREEN_DPI

Startup Script: NodeBase/start-xvfb.sh

Supervisor Configuration:

[program:xvfb] priority=0 command=/opt/bin/start-xvfb.sh autostart=%(ENV_SE_START_XVFB)s autorestart=%(ENV_SE_START_XVFB)s 

The priority=0 setting ensures Xvfb starts before all other components that depend on the display.

Sources: NodeBase/Dockerfile75-79 NodeBase/selenium.conf5-22

x11vnc VNC Server

x11vnc exposes the Xvfb display over the VNC protocol on port 5900, allowing remote desktop clients to view and optionally interact with the browser session.

Key Features:

  • Password protection (default password: secret, stored in ${HOME}/.vnc/passwd)
  • View-only mode support
  • IPv4 and IPv6 support via -rfbport and -rfbportv6
  • Forever mode (-forever) to persist across client disconnections
  • Shared mode (-shared) to allow multiple simultaneous viewers

Startup Logic:

The startup script NodeBase/start-vnc.sh1-66 implements several configuration options:

File Descriptor Limit Handling:

The script includes protection against excessively high ulimit -n values (>100,000), which can cause VNC server instability. See NodeBase/start-vnc.sh45-57 for implementation details.

Sources: NodeBase/start-vnc.sh1-66 NodeBase/Dockerfile156-160 NodeBase/selenium.conf23-39

noVNC Web Client

noVNC provides browser-based access to VNC sessions without requiring VNC client software installation. It uses WebSockets to proxy VNC protocol to web browsers on port 7900.

Implementation:

noVNC is deployed from the official noVNC project, with websockify handling the protocol translation:

ComponentVersionSource
noVNCv1.6.0NOVNC_VERSION build arg
websockifyv0.13.0WEBSOCKIFY_VERSION build arg
Installation/opt/bin/noVNCExtracted from GitHub releases

Startup Process:

The NodeBase/start-novnc.sh1-33 script:

  1. Verifies Xvfb is enabled (SE_START_XVFB=true)
  2. Verifies VNC is enabled (SE_START_VNC=true)
  3. Checks and adjusts file descriptor limits if needed (same logic as x11vnc)
  4. Launches websockify proxy: /opt/bin/noVNC/utils/novnc_proxy --listen ${SE_NO_VNC_PORT} --vnc localhost:${SE_VNC_PORT}

Access URL Format:

http://<container-host>:7900/?autoconnect=1&resize=scale&password=secret 

Query parameters:

  • autoconnect=1: Automatically connect without manual intervention
  • resize=scale: Scale viewport to fit browser window
  • password=secret: Pre-fill VNC password (default)

Sources: NodeBase/Dockerfile124-160 NodeBase/start-novnc.sh1-33 NodeBase/selenium.conf41-57 README.md128-129

Fluxbox Window Manager

Fluxbox provides basic window management functionality, including title bars, minimize/maximize controls, and desktop wallpaper. It is configured to display the Selenium Grid logo as the desktop background.

Installation: NodeBase/Dockerfile108

Wallpaper Configuration:

The script NodeBase/start-vnc.sh8-15 sets the wallpaper using fbsetbg:

The wallpaper image is the Selenium Grid logo: NodeBase/selenium_grid_logo.png

Font Configuration:

Fluxbox is configured to use "WenQuanYi Zen Hei" font for international language support, replacing the default Ubuntu font. See NodeBase/Dockerfile117 for the sed command that modifies the style file.

Sources: NodeBase/Dockerfile108-118 NodeBase/start-vnc.sh8-15 NodeBase/selenium_grid_logo.png

Supervisor Process Management

Supervisor orchestrates the startup, monitoring, and lifecycle of all remote access components. It enforces a strict startup order through priority values to ensure dependencies are met.

Configuration Files:

Deployment ModeConfiguration File
NodeNodeBase/selenium.conf1-73
StandaloneStandalone/selenium.conf1-75

Key Supervisor Settings:

ProgramPriorityautostartautorestartPurpose
xvfb0SE_START_XVFBSE_START_XVFBVirtual display
vnc5SE_START_VNCSE_START_VNCVNC server
novnc10SE_START_NO_VNCSE_START_NO_VNCWeb proxy
selenium-node15truefalseGrid component

Process Lifecycle:

  • xvfb/vnc/novnc: autorestart controlled by environment variables, allowing selective disabling
  • selenium-node/standalone: autorestart=false to prevent restart loops on intentional shutdowns
  • killasgroup=true: Ensures child processes are terminated when parent stops

Log Configuration:

All programs log to /var/log/supervisor/, with rotation configured:

  • stdout_logfile_maxbytes=50MB
  • stderr_logfile_maxbytes=50MB
  • stdout_logfile_backups=5
  • stderr_logfile_backups=5

The Selenium node/standalone redirects all output to stdout for Docker log integration:

redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 

Sources: NodeBase/selenium.conf1-73 Standalone/selenium.conf1-75

Environment Variables Reference

Display Configuration

VariableDefaultDescription
DISPLAY:99.0X11 display identifier
DISPLAY_NUM99Display number for Xvfb
SE_SCREEN_WIDTH1920Virtual screen width in pixels
SE_SCREEN_HEIGHT1080Virtual screen height in pixels
SE_SCREEN_DEPTH24Color depth in bits
SE_SCREEN_DPI96Screen DPI setting

Component Control

VariableDefaultDescription
SE_START_XVFBtrueEnable Xvfb virtual display
SE_START_VNCtrueEnable x11vnc VNC server
SE_START_NO_VNCtrueEnable noVNC web client

VNC Server Configuration

VariableDefaultDescription
SE_VNC_PORT5900VNC server listening port
VNC_PORT5900Alternative variable name
SE_VNC_NO_PASSWORDunsetDisable password authentication (true/1)
VNC_NO_PASSWORDunsetAlternative variable name
SE_VNC_VIEW_ONLYunsetEnable view-only mode (true/1)
VNC_VIEW_ONLYunsetAlternative variable name
SE_VNC_PASSWORDunsetCustom VNC password (overrides default)
VNC_PASSWORDunsetAlternative variable name
SE_VNC_ULIMITunsetCustom file descriptor limit

noVNC Configuration

VariableDefaultDescription
SE_NO_VNC_PORT7900noVNC web server listening port
NO_VNC_PORT7900Alternative variable name

Variable Precedence:

The startup scripts check both VAR_NAME and SE_VAR_NAME forms, with SE_ prefixed versions taking precedence. For example:

Sources: NodeBase/Dockerfile63-79 NodeBase/start-vnc.sh16-34 NodeBase/start-novnc.sh23

Accessing Browser Sessions

Using a VNC Client

Traditional VNC clients provide the most responsive experience with full keyboard and mouse support.

Connection Steps:

  1. Ensure container port 5900 is mapped to the host:

  2. Connect using VNC client:

    • Host: localhost (or container IP)
    • Port: 5900
    • Password: secret (default)

Recommended VNC Clients:

  • RealVNC Viewer
  • TigerVNC
  • TightVNC
  • Remmina (Linux)
  • Screen Sharing (macOS built-in)

Custom Password:

Set a custom VNC password using environment variables:

Password Storage:

The password is hashed and stored at container build time using x11vnc's password storage mechanism. See NodeBase/Dockerfile156:

Sources: README.md98-99 NodeBase/start-vnc.sh30-34

Using Web Browser (noVNC)

noVNC provides instant access without installing additional software, ideal for quick debugging or environments where VNC clients cannot be installed.

Connection Steps:

  1. Ensure container port 7900 is mapped to the host:

  2. Open web browser to:

    http://localhost:7900/?autoconnect=1&resize=scale&password=secret 

URL Parameters:

ParameterValuesDescription
autoconnect0, 1Automatically connect on page load
resizeoff, scale, remoteViewport scaling mode
passwordstringPre-fill VNC password field
pathstringWebSocket path (default: websockify)
encrypt0, 1Use encrypted WebSocket (wss://)

Example from README:

README.md128 demonstrates accessing a running container:

http://localhost:7900/?autoconnect=1&resize=scale&password=secret 

Sources: README.md99-100 README.md128 NodeBase/start-novnc.sh23

Disabling VNC

VNC can be disabled to reduce resource consumption in production environments or when remote access is not needed.

Disable All Remote Access:

Disable Only Web Access:

Note: Disabling Xvfb (SE_START_XVFB=false) is not recommended as browsers require a display to render properly, even in headless mode.

Sources: README.md100 NodeBase/start-vnc.sh5-6 NodeBase/start-novnc.sh5-7

Docker Compose Configuration

Example Docker Compose configurations exposing VNC ports:

For view-only access in production monitoring:

Sources: README.md118-129

Kubernetes/Helm Configuration

In Kubernetes deployments, VNC access can be exposed through Services or Ingress resources. The Helm chart automatically configures VNC services when enabled.

Service Configuration:

By default, the Helm chart creates a Service exposing noVNC port 7900 for each browser node. Access patterns vary by deployment strategy:

  • NodePort: Direct access via http://<node-ip>:<nodeport>
  • LoadBalancer: Access via load balancer external IP
  • Ingress: Path-based routing (e.g., /node/<pod-name>)

Environment Variables in Helm:

The chart passes VNC configuration through values.yaml:

For detailed Helm chart configuration, see Helm Chart Configuration.

Sources: README.md69

Troubleshooting

Issue: VNC Connection Refused

Symptoms: VNC client cannot connect to port 5900

Diagnosis:

  1. Check if VNC is enabled:

  2. Verify port mapping:

  3. Check VNC logs:

Solutions:

  • Ensure SE_START_VNC=true is set
  • Verify Xvfb started successfully: docker exec <container> ps aux | grep Xvfb
  • Check for port conflicts on host

Issue: noVNC Shows Black Screen

Symptoms: Web browser shows black viewport after connecting

Diagnosis:

  1. Verify Xvfb is running:

  2. Check if browser process is running:

Solutions:

  • Ensure browser session is active (no sessions may result in blank display)
  • Verify SE_SCREEN_WIDTH and SE_SCREEN_HEIGHT are reasonable values
  • Check Xvfb logs: docker exec <container> cat /var/log/supervisor/xvfb-stderr.log

Issue: File Descriptor Limit Errors

Symptoms: VNC or noVNC fails to start with "too many open files" error

Diagnosis: Check current limit:

Solutions: The startup scripts automatically handle excessive limits (>100,000), but you can set a custom limit:

See NodeBase/start-vnc.sh45-57 and NodeBase/start-novnc.sh9-21 for automatic limit adjustment logic.

Issue: Wallpaper Not Displaying

Symptoms: Desktop shows plain background instead of Selenium Grid logo

Diagnosis: Check Fluxbox process:

Solutions:

  • Verify selenium_grid_logo.png exists: docker exec <container> ls -la /usr/share/images/fluxbox/ubuntu-light.png
  • Check VNC startup logs for fbsetbg errors
  • Manually set wallpaper: docker exec <container> /usr/bin/fbsetbg -c /usr/share/images/fluxbox/ubuntu-light.png

Sources: NodeBase/start-vnc.sh8-15 NodeBase/Dockerfile171

Security Considerations

Password Protection

Default Security: VNC is password-protected by default with the password secret. This provides basic protection but should not be relied upon for production security.

Recommendations:

  1. Change default password using VNC_PASSWORD environment variable
  2. Use view-only mode (SE_VNC_VIEW_ONLY=true) in production monitoring
  3. Disable password authentication only in isolated, trusted networks

Network Isolation

VNC ports (5900, 7900) should not be exposed to untrusted networks. Use one of:

  • Docker networks for internal access
  • SSH tunneling: ssh -L 5900:localhost:5900 remote-host
  • VPN or private network access
  • Kubernetes NetworkPolicies to restrict access

View-Only Mode

For production monitoring without allowing control:

This prevents keyboard and mouse input while still allowing session observation.

Sources: NodeBase/start-vnc.sh24-28

Performance Considerations

Resource Usage

Each remote access component consumes resources:

ComponentCPU ImpactMemory ImpactNotes
XvfbLow50-100 MBMinimal when no browser active
x11vncLow-Medium20-50 MBIncreases with viewer connections
noVNCLow10-20 MBWebSocket proxy overhead
FluxboxVery Low5-10 MBLightweight window manager

Recommendations:

  • Disable VNC in production if not needed: SE_START_VNC=false
  • Use view-only mode to reduce x11vnc load
  • Limit concurrent viewer connections

Network Bandwidth

VNC streams screen updates continuously, consuming bandwidth:

  • Idle: ~1-5 KB/s
  • Active browsing: ~100-500 KB/s
  • Video playback: ~1-5 MB/s

noVNC includes automatic quality adjustment to adapt to network conditions.

Sources: NodeBase/Dockerfile81-161

This remote access infrastructure integrates with other Selenium Grid systems:

  • Video Recording (#6.1): Records sessions to MP4 files using the same Xvfb display
  • Component Startup (#5.3): Describes how Supervisor orchestrates all container processes
  • Health Checks (#5.4): Probes verify VNC services are responsive
  • Configuration Management (#5.2): Environment variables control VNC behavior

Sources: NodeBase/Dockerfile1-182 NodeBase/selenium.conf1-73