0

When I try to use the selenium:

from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.common.keys import Keys

​browser = webdriver.Chrome()
browser.get('https://automatetheboringstuff.com')

And it gives this error as below:

FileNotFoundError                         Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py in start(self)
     71             cmd.extend(self.command_line_args())
---> 72             self.process = subprocess.Popen(cmd, env=self.env,
     73                                             close_fds=platform.system() != 'Windows',

C:\ProgramData\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, 
stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, 
creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    857 
--> 858             self._execute_child(args, executable, preexec_fn, close_fds,
    859                                 pass_fds, cwd, env,

C:\ProgramData\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, 
preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, 
p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, 
unused_start_new_session)
   1310             try:
-> 1311                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1312                                          # no special security

FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)
<ipython-input-3-f110b31d9196> in <module>
      3 from selenium.webdriver.common.keys import Keys
      4 
----> 5 browser = webdriver.Chrome()
      6 browser.get('https://automatetheboringstuff.com')

C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\chrome\webdriver.py in 
__init__(self, executable_path, port, options, service_args, desired_capabilities, 
service_log_path, chrome_options, keep_alive)
     71             service_args=service_args,
     72             log_path=service_log_path)
---> 73         self.service.start()
     74 
     75         try:

C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py in start(self)
     79         except OSError as err:
     80             if err.errno == errno.ENOENT:
---> 81                 raise WebDriverException(
     82                     "'%s' executable needs to be in PATH. %s" % (
     83                         os.path.basename(self.path), self.start_error_message)

WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Please what can I do to resolve this error? I never could get selenium to work. It seems to be impossible.

0 Answers0