1

I want to run selenium in google colab i ran the following code:

    !apt update
    !apt install chromium-chromedriver
    !pip install selenium
    # set options to be headless, ..
    from selenium import webdriver
    options = webdriver.ChromeOptions()
    options.add_argument('--headless')
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-dev-shm-usage')
    # open it, go to a website, and get results
    wd = webdriver.Chrome(options=options)
    wd.get("https://www.whoscored.com")
    print(wd.page_source)  # results`

the result expected is the page source being printed out instead i get this error in my notebook:

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1

Here is the link of the notebook:
https://colab.research.google.com/drive/13oUHGDc6uy-4vJ1XnRdEcojoFoIToV75 i tried changing the webdriver to firefox but i get a different error memory related stuff:

src/tcmalloc.cc:332] Attempt to free invalid pointer 0x24680020c5d0

Prophet
  • 32,350
  • 22
  • 54
  • 79
Bug Alpha
  • 13
  • 1
  • 5
  • Dublicate https://stackoverflow.com/questions/75155063/selenium-use-chrome-on-colab-got-unexpectedly-exited – kaliiiiiiiii Jan 20 '23 at 13:01
  • Does this answer your question? [Selenium use chrome on Colab got unexpectedly exited](https://stackoverflow.com/questions/75155063/selenium-use-chrome-on-colab-got-unexpectedly-exited) – kaliiiiiiiii Jan 20 '23 at 13:01

1 Answers1

0

I found out the solution from Selenium use chrome on Colab got unexpectedly exited. Looks like it was a runtime issue. Changing it and following the steps in the link helped and I executed the code there to fix the problem

Humble_PrOgRaMeR
  • 689
  • 4
  • 14
  • 34
Bug Alpha
  • 13
  • 1
  • 5