I'm using selenium and chromedriver to control some chrome instances under debian linux. I would like to make these chrome instances headless and i also would like to start them on different virtual displays via Xvfb which have different display-resolutions.
My java/selenium code works perfekt using the chrome binary directly (non-headless). Strictly speaking the chrome binary (/usr/bin/google-chrome) is also only a wrapper script which is in the path. Using my self-made chrome wrapper script (and set it as binary in chromeOptions, like described here: https://sites.google.com/a/chromium.org/chromedriver/capabilities ) it doesn't work and fails with: unknown error: Chrome failed to start: exited abnormally
I think the reason is my wrapper script. What is wrong or what should i improve? This is the script:
#!/bin/bash
export DISPLAY=:1920
cd /usr/bin/
google-chrome "$@"
The java-code which sets the wrapper script as chrome binary via chromeOptions:
// set custom binary
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/executable-wrapper-script");
Please remind that the Xvfb displays are running, so that's not the problem. I tested them with x11vnc and i also get chrome started on them, calling the wrapper script directly in my shell.