title: How to fix selenium "DevToolsActivePort file doesn't exist" exception in Python
body: <p>When I use both arguments <code>--headless</code> and <code>user-data-dir</code>. Selenium raise <code>selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist</code> exception. If only 1 of them is used, then everything works as needs. </p>
  
  <p>I tried to swap arguments and remove some of them. 
  Specified the full path to chromedriver.exe. 
  None of this helped. </p>
  
  <p><strong>chromeOptions.add_argument("--disable-dev-shm-using") DIDN'T HELP ME.</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>login = "test"
  chromeOptions = webdriver.ChromeOptions() 
  chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) 
  chromeOptions.add_argument("--no-sandbox") 
  chromeOptions.add_argument("--disable-setuid-sandbox") 
  chromeOptions.add_argument("--disable-dev-shm-using") 
  chromeOptions.add_argument("--disable-extensions") 
  chromeOptions.add_argument("--disable-gpu") 
  chromeOptions.add_argument("start-maximized") 
  chromeOptions.add_argument("disable-infobars") 
  chromeOptions.add_argument("--headless") 
  chromeOptions.add_argument(r"user-data-dir=.\cookies\\" + login) 
  b = webdriver.Chrome(chrome_options=chromeOptions) 
  b.get("https://google.com/") 
  b.quit() 
  </code></pre>