Click here to Skip to main content
14,977,259 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello i try too work with selenium on python but chrome driver give me an error
my code :
from selenium import webdriver
driver = webdriver.Chrome(executable_path = 'chromedriver.exe')

error :
Traceback (most recent call last):
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

    self.service.start()
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home  

PS D:\codes>


           > & C:/Users/eskandarijoon/AppData/Local/Programs/Python/Python39/python.exe d:/codes/slnm/main.py
Traceback (most recent call last):
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

  File "d:\codes\slnm\main.py", line 3, in <module>
    driver = webdriver.Chrome(executable_path = r'D:\codes\slnm(1)\chromedriver.exe')
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home  

PS D:\codes> & C:/Users/eskandarijoon/AppData/Local/Programs/Python/Python39/python.exe d:/codes/slnm/main.py
Traceback (most recent call last):
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

  File "d:\codes\slnm\main.py", line 3, in <module>
    driver = webdriver.Chrome(executable_path = r'D:\codes\slnm(1)\chromedriver.exe')
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home  

PS D:\codes> & C:/Users/eskandarijoon/AppData/Local/Programs/Python/Python39/python.exe d:/codes/slnm/main.py
Traceback (most recent call last):
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

  File "d:\codes\slnm\main.py", line 2, in <module>
    driver = webdriver.Chrome(executable_path = 'chromedriver.exe')
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home  

PS D:\codes> & C:/Users/eskandarijoon/AppData/Local/Programs/Python/Python39/python.exe d:/codes/slnm/main.py
Traceback (most recent call last):
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\codes\slnm\main.py", line 2, in <module>
    driver = webdriver.Chrome(executable_path = 'chromedriver.exe')
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\eskandarijoon\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home  


What I have tried:

from selenium import webdriver
driver = webdriver.Chrome(executable_path = 'chromedriver.exe')
Posted
Updated 23-Apr-21 20:03pm

1 solution

Read the messages: some of them are very significant.
FileNotFoundError: [WinError 2] The system cannot find the file specified

selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
So follow the link, and see exactly what it says ...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900