2

I wrote a function for scraping data from a website in a Jupyter Notebook. The function works perfectly fine when running in that notebook and when I use ipynb to import the functions from that notebook it imports them successfully. Then when I run the function in the second notebook I get: WebDriverException: Message: 'chromedriver' executable needs to be in PATH.. The weirdest part is that this works fine on my MacBook but not on my PC. Has anyone encountered this and found a solution?

The import I use is: from ipynb.fs.full.my_notebook import my_function. I then create a dataframe using df = my_function(x, y, z), which is where I get the error.

lepsch
  • 8,927
  • 5
  • 24
  • 44
sla813
  • 45
  • 4

1 Answers1

0

It's possible to set the path to chromedriver executable instead of using the one in the PATH.

from selenium.webdriver.chrome.service import Service

service = Service(executable_path='/Users/<user_name>/Downloads/chromedriver')

...
lepsch
  • 8,927
  • 5
  • 24
  • 44
  • I still get the same error using this method. – sla813 Jul 14 '22 at 03:58
  • 1
    I've found an answer in the following link. Does this help? https://stackoverflow.com/questions/29858752/error-message-chromedriver-executable-needs-to-be-available-in-the-path – lepsch Jul 14 '22 at 05:55