Webots doesn't have any headless mode per se, however, there are several arguments that will allow you to run it on a server without any ui (https://cyberbotics.com/doc/guide/starting-webots#command-line-arguments):
- batch: Prevent Webots from creating blocking pop-up windows.
- stdout: Redirect the stdout of the controllers to the terminal.
- stderr: Redirect the stderr of the controllers to the terminal.
- minimize: Minimize the Webots window on startup.
- mode=: Choose the startup mode, overriding application preferences. The argument must be either pause, realtime, run or fast.
In addition to this, there are several environment variables that you might need to set (on Linux at least):
export DEBIAN_FRONTEND=noninteractive
export DISPLAY=:99
export LIBGL_ALWAYS_SOFTWARE=true
Finally, you may need to start a virtual screen with Xvfb:
Xvfb :99 -screen 0 1024x768x16 &
Following these steps I have been able for example to run Webots in a headless Docker environment: https://github.com/cyberbotics/webots/wiki/Docker