I am trying to use the new (2016) headless version of Chromium with Selenium/ChromeDriver (In the past, I used Firefox with xfvb but this promises to be much better).
I have compiled a headless version of Chromium from sources (I did not find any pre-built binaries) based on the instructions I found here and then I used the following code to launch it through Selenium:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
l_option = Options()
l_option.add_argument('headless')
l_option.add_argument('disable-notifications')
l_option.binary_location = '/home/fi11222/Headless_Chromium/headless_shell'
l_driver = webdriver.Chrome(chrome_options=l_option)
The same code works with the standard chromium (if I remove the binary.location
option)
As is, however, I get the following error:
selenium.common.exceptions.WebDriverException: Message: unknown error: unrecognized Chrome version: HeadlessChrome/59.0.3032.0
(Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.4.0-53-generic x86_64)
Apparently, the headless chromium binary is compiled with a version ID that ChromeDriver does not recognize. Help !!
Environment:
- Compilation: Ubuntu 16.04 server
- Selenium execution: Linux Mint 18.1