Reputation: 43
I was trying to use Selenium on Google Colab, then an error occurred.
The error message was "chromedriver' executable needs to be in PATH."
I googled and found a solution. The solution was as follows:
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome('chromedriver',options=options)
When I removed the --headless
option, the following error occurred.
WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Is there no way to use Selenium on Google Colab without the --headless
option?
Upvotes: 3
Views: 2731
Reputation: 29362
No there isn't. Google colab
is meant for --headless
mode.
You can not simply invoke the object of the real browser.
Upvotes: 4