selenium - chromedriver 実行可能ファイルは PATH に存在する必要があります [重複] 質問する

selenium - chromedriver 実行可能ファイルは PATH に存在する必要があります [重複] 質問する

エラーメッセージ:

'chromedriver' 実行ファイルは PATH に存在する必要があります

Pycharm で Selenium を使用してスクリプトをコーディングしようとしましたが、上記のエラーが発生しました。私はすでに、ここにあるように、Selenium を Pycharm にリンクしています (最新の状態)

私は Selenium を初めて使うのですが、Chromedriver は「Selenium」フォルダにありませんか。ない場合は、どこで見つけてパスに追加できますか?

ちなみに、cmd に「chromedriver」と入力してみましたが、内部コマンドとしても外​​部コマンドとしても認識されませんでした。

下記のエラーが表示されます:

Traceback (most recent call last):
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
PermissionError: [WinError 5] Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/sebastian/PycharmProjects/web/bot.py", line 10, in <module>
    browser = webdriver.Chrome("C:/Users/sebastian/desktop/selenium-3.0.1")
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'selenium-3.0.1' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x01EDEAF0>>
Traceback (most recent call last):
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 163, in __del__
    self.stop()
  File "C:\Users\sebastian\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
    if self.process is None:
AttributeError: 'Service' object has no attribute 'process'

ベストアンサー1

ChromeDriver はここからダウンロードできます:https://sites.google.com/chromium.org/driver/

すると複数のオプション:

  • システムに追加するpath

  • Pythonスクリプトと同じディレクトリに置いてください

  • 場所を直接指定するexecutable_path

     driver = webdriver.Chrome(executable_path='C:/path/to/chromedriver.exe')
    

おすすめ記事