简体   繁体   中英

How can I find chromedriver.exe for chrome version 94.0.4606.61

I am currently working with Jupyter notebook on VS code. But I can't locate the path for the chromedriver.exe file for the 94.0.4606.61 version of Chromedriver.

I searched and still can't find a solution to this. I got some lines of these codes from the previous question asked on Stack Overflow:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
from selenium.webdriver.chrome.service import Service
service=Service(r'C:/path/to/Users/User/.wdm/drivers/chromedriver/win32/94.0.4606.61')
driver=webdriver.Chrome(service=service)

I was trying to resolve the deprecation issue C:\\Users\\User\\AppData\\Local\\Temp/ipykernel_17908/1503906442.py:1: DeprecationWarning: executable_path has been deprecated, please pass in a Service object , and hence, I tried to locate Chromedriver.exe And when I resolved the deprecation issues, another error occurred with this line of code I typed ( as shown above ): driver=webdriver.Chrome(service=service) ,

and then this error message from VS Code:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py in start(self)
     73             cmd.extend(self.command_line_args())
---> 74             self.process = subprocess.Popen(cmd, env=self.env,
     75                                             close_fds=system() != 'Windows',

C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\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, user, group, extra_groups, encoding, errors, text, umask)
    950 
--> 951             self._execute_child(args, executable, preexec_fn, close_fds,
    952                                 pass_fds, cwd, env,

C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64__qbz5n2kfra8p0\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_gid, unused_gids, unused_uid, unused_umask, unused_start_new_session)
   1419             try:
-> 1420                 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
   1421                                          # 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)
~\AppData\Local\Temp/ipykernel_17908/1442944818.py in <module>
----> 1 driver=webdriver.Chrome(service=service)

~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\chrome\webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options, service, keep_alive)
     67             service = Service(executable_path, port, service_args, service_log_path)
     68 
---> 69         super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
     70                                         port, options,
     71                                         service_args, desired_capabilities,

~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\chromium\webdriver.py in __init__(self, browser_name, vendor_prefix, port, options, service_args, desired_capabilities, service_log_path, service, keep_alive)
     88 
     89         self.service = service
---> 90         self.service.start()
     91 
     92         try:

~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py in start(self)
     82         except OSError as err:
     83             if err.errno == errno.ENOENT:
---> 84                 raise WebDriverException(
     85                     "'%s' executable needs to be in PATH. %s" % (
     86                         os.path.basename(self.path), self.start_error_message)

WebDriverException: Message: '94.0.4606.61' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

Also, when I tried to run these codes ( as shown below ), deprecation issue and FileNotFoundError occurred simultaneously:

import time
from selenium import webdriver
driver = webdriver.Chrome('/path/to/chromedriver')

I found this website saying that:

"chromedriver(.exe)" does not appear in Solution Explorer, but it is copied to the output folder from the package source folder when the build process.

What does it mean?

How can I resolve this issue? I am using Windows and Chrome version 94.

Edit

I found some tips in this video: How To Fix -Executable path has been deprecated please pass in a Service object in Selenium Python

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service(executable_path="C:/Users/User/.wdm/drivers/chromedriver/win32/94.0.4606.61")
driver = webdriver.Chrome(Service = s)

However, driver = webdriver.Chrome(Service = s) is giving TypeError

------------------------------------------------------------------------

---
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11848/787057698.py in <module>
----> 1 driver = webdriver.Chrome(Service = s)

TypeError: __init__() got an unexpected keyword argument 'Service'

Try it like this:

import selenium
from selenium import webdriver


PATH = "r'C:/path/to/Users/User/.wdm/drivers/chromedriver/win32/94.0.4606.61'"

driver = webdriver.Chrome(PATH)

You can find them here

https://chromedriver.chromium.org/downloads

Since you Chrome version is 94 so you need to download this

https://chromedriver.storage.googleapis.com/94.0.4606.61/chromedriver_win32.zip

Put in maybe C driver and provide path like

import selenium
from selenium import webdriver


PATH = r"C:/chromedriver.exe"

driver = webdriver.Chrome(PATH)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM