title: How passing --headless option to chrome from a Java command running Selenium tests with TestNG?
body: <p>We are running <em>Selenium</em> tests from a <em>Java</em> command line with <em>TestNG</em>.</p>
  <p>The one who launch them can select the browser he wants to target: <code>FIREFOX</code>, <code>CHROME</code>...<br />
  For example:</p>
  <pre class="lang-sh prettyprint-override"><code>java -Dbrowser=CHROME -Dtestng.dtd.http=true -Dwdm.chromeDriverVersion=94.0.4606.61 \
  -classpath ourTest.jar;ourApplication.jar org.testng.TestNG -testjar ourTest.jar 
  </code></pre>
  <p>I would like to launch these tests in headless mode (a ability of the <em>Chrome</em> browser), sometimes.</p>
  <p>I tried :</p>
  <pre class="lang-sh prettyprint-override"><code>java [...] org.testng.TestNG -testjar ourTest.jar --headless
  java [...] -DadditionalBrowserArguments=--headless org.testng.TestNG -testjar ourTest.jar
  </code></pre>
  <p>and many others names for the <code>-D</code> option to pass this <code>--headless</code> value.<br />
  But my tests are still running with a browser coming in the front...</p>
  <p>What is the good parameter to set, to the <code>--headless</code> option to <em>Chrome</em> through <em>Java</em> running <em>Selenium</em> by <em>TestNG</em>?</p>