jpjacobpadilla / Google-Colab-Selenium

The best way to use Selenium in Google Colab Notebooks!
https://pypi.org/project/google-colab-selenium/
MIT License
156 stars 18 forks source link

CalledProcessError when updating APT when running driver = gs.Chrome() #9

Closed mack-h closed 2 months ago

mack-h commented 3 months ago

Hi there, I've been wracking my comp all day trying get selenium to work in Colab. The driver it snags (ChromeDriver v91) is incompatible with the Chrome browser (v126), and I don't know how you've found a way around it! I've tried to meet in the middle by upgrading the driver and deprecating the browser to v114 (the highest the driver goes), but alas, cannot access the v114 version of Chrome (and maybe I don't want to?...I'm new to this!)

Very excited about this and seems like you've found a great solution that's helped a ton of people, so thank you!

Anyway, here is the error I'm getting when running driver = gs.Chrome() I don't get it in your sample notebook, so maybe it's a configuration thing:

Updated and upgraded APT

CalledProcessError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/google_colab_selenium/colab_selenium_manager.py in update_upgrade_apt(cls) 46 with Spinner('Updating and upgrading APT', done='Updated and upgraded APT'): ---> 47 subprocess.run(cls.update_apt, check=True) 48 subprocess.run(cls.upgrade_apt, check=True)

4 frames CalledProcessError: Command '['sudo', 'apt', 'update']' returned non-zero exit status 100.

The above exception was the direct cause of the following exception:

GoogleColabSeleniumError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/google_colab_selenium/colab_selenium_manager.py in update_upgrade_apt(cls) 49 50 except Exception as e: ---> 51 raise GoogleColabSeleniumError('Failed to update and upgrade APT') from e 52 53 else:

GoogleColabSeleniumError: Failed to update and upgrade APT

jpjacobpadilla commented 2 months ago

Just seeing this, do you mind sending a Google Colab notebook recreating the issue? It seems to work in the example notebook (in the README), so the notebook that you're using may have some extra code in it that this package may not like 🤔.

mack-h commented 2 months ago

I tried it in a fresh notebook last time, and it didn't work in mine, but worked in yours -- just tried it again in mine, and it's working! Also working in my grotesque mutant notebook that doubles as a graveyard for alternative ways to finagle this. I uninstalled and reinstalled Chrome and the Driver so many times, maybe it just needed a couple days to reset. Thanks for responding!