!pip install selenium
!apt-get update !apt-get upgrade !apt install chromium-chromedriver !cp /usr/lib/chromium-browser/chromedriver /usr/bin
–no-sandbox
がないと動かないimport time from selenium import webdriver from selenium.webdriver.chrome.options import Options def main(): # オプションの追加 option = Options() option.add_argument('--headless') option.add_argument('--disable-gpu') option.add_argument('--mute-audio') option.add_argument('--no-sandbox') # option.add_argument('--disable-dev-shm-usage') # ドライバの設定 driver = webdriver.Chrome( 'chromedriver', options=option ) # 以下処理 # ドライバの破棄 driver.quit() if (__name__ == '__main__'): main()