title: How to connect to Chromium Headless using Selenium
body: <p>I would like to use chromium headless for automated testing using selenium. (<a href="https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md" rel="noreferrer">https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md</a>)</p>
  
  <p>I do have the headless version already running on 9222. So if i open <a href="http://10.252.100.33:9222/json/I" rel="noreferrer">http://10.252.100.33:9222/json/I</a> do get </p>
  
  <pre><code>[ {
     "description": "",
     "devtoolsFrontendUrl": "/devtools/inspector.html?ws=127.0.0.1:9223/devtools/page/0261be06-1271-485b-bdff-48e443de7a91",
     "id": "0261be06-1271-485b-bdff-48e443de7a91",
     "title": "The Chromium Projects",
     "type": "page",
     "url": "https://www.chromium.org/",
     "webSocketDebuggerUrl": "ws://127.0.0.1:9223/devtools/page/0261be06-1271-485b-bdff-48e443de7a91"
  } ]
  </code></pre>
  
  <p>As a next step I'd like to connect selenium to the headless chromium. But when i try</p>
  
  <pre><code>final DesiredCapabilities caps = DesiredCapabilities.chrome();
  final WebDriver driver = new RemoteWebDriver(new URL("http://localhost:9222/json"), caps);
  driver.get("http://www.google.com");
  </code></pre>
  
  <p>I do get the following logout</p>
  
  <pre><code>Jän 24, 2017 7:14:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFORMATION: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
  Jän 24, 2017 7:14:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFORMATION: Falling back to original OSS JSON Wire Protocol.
  Jän 24, 2017 7:14:45 PM org.openqa.selenium.remote.ProtocolHandshake createSession
  INFORMATION: Falling back to straight W3C remote end connection
  
  org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, version=, platform=ANY}], required capabilities = Capabilities [{}]
  Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
  System info: host: 'Geralds-MacBook-Pro.local', ip: '192.168.0.249', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.2', java.version: '1.8.0_111'
  Driver info: driver.version: RemoteWebDriver
  </code></pre>
  
  <p>Questions are: </p>
  
  <ul>
  <li>Is the RemoteWebDriver the correct driver to connect to the headless
  chromium?</li>
  <li>I read about the DevTool protocol (<a href="https://docs.google.com/presentation/d/1gqK9F4lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/" rel="noreferrer">https://docs.google.com/presentation/d/1gqK9F4lGAY3TZudAtdcxzMQNEE7PcuQrGu83No3l0lw/</a>), but I'm not sure, how to create such a client using selenium.</li>
  <li>Connecting the Chromium Headless using the Chrome DevTools works (<a href="https://developers.google.com/web/tools/chrome-devtools/remote-debugging/" rel="noreferrer">https://developers.google.com/web/tools/chrome-devtools/remote-debugging/</a>) besides some segmentation vaults ;-)</li>
  </ul>