title: How to use Selenium on Colaboratory Google?
body: <p>I scraping many info from web, and I hope it works on cloud.
  So I'd like to use colaboratory, but it turned error</p>
  <pre><code>WebDriverException                        Traceback (most recent call last)
  &lt;ipython-input-35-abcc3b93dfa7&gt; in &lt;module&gt;()
       20 options.add_argument(&quot;--start-maximized&quot;);
       21 options.add_argument(&quot;--headless&quot;);
  ---&gt; 22 driver = webdriver.Chrome('chromedriver', chrome_options=options)
       23 
       24 book  = cd + &quot;/target.xlsx&quot;
  
  /usr/local/lib/python3.6/dist-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, keep_alive)
       71             service_args=service_args,
       72             log_path=service_log_path)
  ---&gt; 73         self.service.start()
       74 
       75         try:
  
  /usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in start(self)
       96         count = 0
       97         while True:
  ---&gt; 98             self.assert_process_still_running()
       99             if self.is_connectable():
      100                 break
  
  /usr/local/lib/python3.6/dist-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
      109             raise WebDriverException(
      110                 'Service %s unexpectedly exited. Status code was: %s'
  --&gt; 111                 % (self.path, return_code)
      112             )
      113 
  
  WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: -6
  </code></pre>
  <p>I read the articles, and it says this works.
  <a href="https://stackoverflow.com/questions/51046454/how-can-we-use-selenium-webdriver-in-colab-research-google-com">How can we use Selenium Webdriver in colab.research.google.com?</a>
  But actually not.</p>
  <p>Any Ideas are appreciated.</p>
  <p>My option is</p>
  <pre><code>options = Options()
  options.add_argument('--headless')
  options.add_argument('--no-sandbox')
  options.add_argument('--disable-dev-shm-usage')
  options.add_argument('--disable-gpu')
  driver = webdriver.Chrome('chromedriver', chrome_options=options)
  </code></pre>
  <p>↑
  this last sentence makes error</p>
  <pre><code>WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: -6
  </code></pre>
  <p>============================================
  My entire chart</p>
  <pre><code>!sudo apt install unzip
  !wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
  !unzip chromedriver_linux64.zip -d /usr/bin/
  from google.colab import drive
  drive.mount('/content/drive')
  !pip install selenium
  !pip install openpyxl
  </code></pre>
  <p>then, python script is</p>
  <pre><code>cd = &quot;drive/My Drive/doc/業務資料/イーコレ/scrape/*&quot;
  import os, subprocess
  import sys
  sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
  import selenium
  import bs4
  from selenium import webdriver
  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.common.by import By
  from selenium.common.exceptions import TimeoutException
  from bs4 import BeautifulSoup
  import openpyxl
  import time, re, csv, urllib.parse
  options = Options()
  options.add_argument('--headless')
  options.add_argument('--no-sandbox')
  options.add_argument('--disable-dev-shm-usage')
  options.add_argument('--disable-gpu')
  driver = webdriver.Chrome('chromedriver', chrome_options=options)
  </code></pre>