user11391572
user11391572

Reputation:

chromedriver executable not found in path, but I have it in path according to echo

So, I'm trying to use chromedriver for the first time. I'm finding myself very frustrating because I'm getting an exception telling me that chromedriver isn't found in path, but it really seems like it IS in my path.

  self.service.start()
  File "/Users/lukeanglin/opt/anaconda3/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home```

❯ echo $PATH
/Users/lukeanglin/opt/anaconda3/bin:/Users/lukeanglin/opt/anaconda3/bin:/Users/lukeanglin/opt/anaconda3/condabin:/anaconda3/bin:/Users/lukeanglin/miniconda3/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/lukeanglin/Desktop/Website/chromedriver:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands

I'm just not certain what I've done wrong here. Any help would be appreciated!

EDIT:

Here is the relevant part of my code. Do to one helpful comment, the chromedriver is now found. However, I'm now trying to figure out why it's not executing. It seems like my computer thinks it's malware, so I'm trying to get around that.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import os
driver = webdriver.Chrome(executable_path="./chromedriver")

FINAL EDIT: Thanks to the help from the two commenters, I was able to get this worked out. Thanks guys, you rock! For anyone who may have the same issue with malware detection, use xattr -d on mac.

Upvotes: 1

Views: 271

Answers (1)

prxvidxnce
prxvidxnce

Reputation: 369

I don't know what the code looks like, but from what I know, is that when I put my chromedriver and my .py file in the same folder and run it through an IDE, it works fine but it gives me that error when I run it straight with python. So you can try this

from selenium import webdriver

driver = webdriver.Chrome(executable_path = r'path_to_chromedriver.exe')

Upvotes: 1

Related Questions