I use Selenium in Python(Google Colab) for scraping.
Error occurred even though nothing was changed.
It worked fine yesterday.
Sometimes it works, sometimes it doesn't.
Why does this happen?
ERROR
---------------------------------------------------------------------------
WebDriverException Traceback (most recent call last)
<ipython-input-2-f1882ef81cb2> in <module>
15 options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36')
16
---> 17 driver = webdriver.Chrome('chromedriver',options=options)
18 driver.maximize_window()
19
3 frames
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
117 return_code = self.process.poll()
118 if return_code:
--> 119 raise WebDriverException(f"Service {self.path} unexpectedly exited. Status code was: {return_code}")
120
121 def is_connectable(self) -> bool:
WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
CODE
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium
import time
import random
import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36')
driver = webdriver.Chrome('chromedriver',options=options) #Error here
driver.maximize_window()
#skip the rest
It would be appreciated if you could give me some hint.