title: python using selenium, error: chrome unexpectedly exited. Status code was: 0
body: <p>This is <strong>not</strong> a repost of</p>
  <p><a href="https://stackoverflow.com/questions/52112188/selenium-common-exceptions-webdriverexception-message-unknown-error-chrome-fa">selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed with ChromeDriver and Selenium in Python</a></p>
  <p>I am using Linux and creating a new profile is <strong>not an option</strong>. I want to load an <strong>existing profile</strong> (not create a new one) just like selenium gui can.</p>
  <p>I am able to get chromium to function, but not google chrome. Chrome will open but will kick back an</p>
  <pre><code>selenium.common.exceptions.WebDriverException: Message: Service /opt/google/chrome/chrome unexpectedly exited. Status code was: 0
  </code></pre>
  <p>error.</p>
  <p>I am trying to start google chrome with user directory access, so I can capture existing sessions.</p>
  <p>code that fails:</p>
  <pre><code>option.add_argument(&quot;user-data-dir=/home/user/.config/google-chrome/Default/&quot;) #)PATH is path to your chrome profile
  driver = webdriver.Chrome('/opt/google/chrome/chrome', options=option)
  </code></pre>
  <p>code that works but launches chromium and not google-chrome:</p>
  <pre><code>option.add_argument(&quot;user-data-dir=/home/user/snap/chromium/common/.cache/chromium/Default/&quot;) #)PATH is path to your&gt;
  driver = webdriver.Chrome('/snap/bin/chromium.chromedriver', options=option)
  </code></pre>
  <p>I'm sure I am using the correct executable</p>
  <p><a href="https://i.stack.imgur.com/obitL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/obitL.png" alt="htop" /></a></p>
  <p>I'm pretty sure I have the correct chromedriver driver install</p>
  <pre><code>root@Inspiron-laptop:/home/user# pip3 install chromedriver-autoinstaller
  Requirement already satisfied: chromedriver-autoinstaller in /usr/local/lib/python3.8/dist-packages (0.2.2)
  </code></pre>
  <p>Just using it incorrectly.</p>
  <p>How do I launch google-chrome from within selenium while accessing cache directories?</p>
  <p>I am on Ubuntu 20.04</p>
  <p>UPDATE:</p>
  <p>Full script:</p>
  <pre><code>#!/usr/bin/python3
  
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support import expected_conditions as EC
  
  from selenium import webdriver
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.common.by import By
  from seleniumbase import BaseCase
  from selenium.webdriver.chrome.options import Options
  import time
  import random
  
  minptime = 25
  maxptime = 120
  
  class MyweClass(BaseCase):
          def method_a():
                  option = webdriver.ChromeOptions()
                  option.add_argument('--disable-notifications')
                  option.add_argument(&quot;--mute-audio&quot;)
                  option.add_argument(&quot;user-data-dir=/home/user/.config/google-chrome/Default/&quot;) #)PATH is path to your chrome profile
                  driver = webdriver.Chrome('/opt/google/chrome/chrome', options=option)
                  driver.get(&quot;https://world.com/myworld&quot;)
                  print(f'driver.command_executor._url: {driver.command_executor._url}')
                  print(f'driver.session_id: {driver.session_id}')
                  time.sleep(18)
                  return driver
  driver = MyweClass.method_a()
  </code></pre>
  <p>UPDATE II:</p>
  <p>Same error using</p>
  <pre><code>option.add_argument(&quot;user-data-dir=~/.config/google-chrome/Default/&quot;)
  </code></pre>
  <p>and</p>
  <pre><code>driver = webdriver.Chrome('/opt/google/chrome/google-chrome', options=option)
  </code></pre>
  <p>and</p>
  <pre><code>chmod -R 777 /home/user/.config
  </code></pre>
  <p>To ensure user was hitting cache directory as user.</p>
  <p>Google chrome info:</p>
  <p><a href="https://i.stack.imgur.com/b4p7I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b4p7I.png" alt="enter image description here" /></a></p>