I am trying to use Selenium in Google Colab, but i get some errors when i try to run a Firefox instance. i followed this links:
- Selenium documentation here, i tried with the Driver Management Software but i got the error that says that was unable to find the binary location to Firefox, so i follow this other link , but i was unable to make it run
So i tried with the Hard Coded Location, but I got the error:
Message: 'geckodriver' executable needs to be in PATH.
I actually downloaded the geckodrive and follow this link
I've uploaded the grecodriver to my Drive and access with the google.colab library, but i always got the error:
No such file or directory: '/content/drive/MyDrive/Santillana/geckodriver'
Here is my code:
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.firefox.service import Service as FirefoxService
from webdriver_manager.firefox import GeckoDriverManager
from google.colab import drive
drive.mount('/content/drive', force_remount=True)
service = FirefoxService(executable_path= '/content/drive/MyDrive/Santillana/geckodriver')
driver = webdriver.Firefox(service=service)
The entire error:
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
75 stdin=PIPE,
---> 76 creationflags=self.creationflags)
77 except TypeError:
4 frames
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/Santillana/geckodriver': '/content/drive/MyDrive/Santillana/geckodriver'
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
81 raise WebDriverException(
82 "'%s' executable needs to be in PATH. %s" % (
---> 83 os.path.basename(self.path), self.start_error_message)
84 )
85 elif err.errno == errno.EACCES:
WebDriverException: Message: 'geckodriver' executable needs to be in PATH.