title: unknown error: failed to wait for extension background page to load: chrome-extension error loading an extension to Chrome Headless using Selenium
body: <p>I try to run chromedriver via selenium in headless mode.</p>
  <p>IMPORTANT
  The code runs perfectly fine if I eliminate the following code lines (but is not headless):</p>
  <pre><code>chrome_options.add_argument('--headless')
  chrome_options.add_argument('--no-sandbox')
  chrome_options.add_argument('--disable-dev-shm-usage')
  </code></pre>
  <p>This is the error I get when I try to implement the headless argument:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;camel.py&quot;, line 83, in &lt;module&gt;
      executable_path=executable_path)
    File &quot;/home/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py&quot;, line 81, in __init__
      desired_capabilities=desired_capabilities)
    File &quot;/home/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 157, in __init__
      self.start_session(capabilities, browser_profile)
    File &quot;/home/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 252, in start_session
      response = self.execute(Command.NEW_SESSION, parameters)
    File &quot;/home/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 321, in execute
      self.error_handler.check_response(response)
    File &quot;/home/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py&quot;, line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.WebDriverException: Message: unknown error: failed to wait for extension background page to load: chrome-extension://jkompbllimaoekaogchhkmkdogpkhojg/_generated_background_page.html
  from unknown error: page could not be found: chrome-extension://jkompbllimaoekaogchhkmkdogpkhojg/_generated_background_page.html
  </code></pre>
  <p>This are the lines 81, 82 and 83</p>
  <pre><code>chrome_options.add_extension(extension_path)
  driver = webdriver.Chrome(options=chrome_options,
                            executable_path=executable_path)
  </code></pre>
  <p>This is the code (the crhomedriver execution parts):</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver import Chrome
  from selenium.webdriver.common.by import By
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.chrome.options import Options
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  from selenium.webdriver.support.expected_conditions import presence_of_element_located
  
  import os
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
  
  chrome_options = Options()
  chrome_options.add_argument('--headless')
  chrome_options.add_argument('--no-sandbox')
  chrome_options.add_argument('--disable-dev-shm-usage')
  log_path = os.path.join(BASE_DIR, 'cronJobChromeDriver.log')
  
  executable_path = os.path.join(BASE_DIR, 'chromedriver_linux64/chromedriver')
  extension_path = os.path.join(
      BASE_DIR, 'chromedriver_linux64/extension_2_8_9_0.crx')
  print('executable_path', executable_path)
  </code></pre>