问题遇到的现象和发生背景
用代码块功能插入代码,请勿粘贴截图
我想要达到的结果
from selenium import webdriver
webdriver=webdriver.Chrome(r"C:\Users\24928\Anaconda3\share\jupyter\kernels\python3\chromedriver.exe")
webdriver.get(url='https://www.baidu.com')
C:\Users\24928\AppData\Local\Programs\Python\Python37\python.exe C:/Users/24928/PycharmProjects/佛子/佛子.py
C:/Users/24928/PycharmProjects/佛子/佛子.py:2: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
webdriver=webdriver.Chrome(r"C:\Users\24928\Anaconda3\share\jupyter\kernels\python3\chromedriver.exe")
Traceback (most recent call last):
File "C:/Users/24928/PycharmProjects/佛子/佛子.py", line 2, in
webdriver=webdriver.Chrome(r"C:\Users\24928\Anaconda3\share\jupyter\kernels\python3\chromedriver.exe")
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 72, in init
service_log_path, service, keep_alive)
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 97, in init
options=options)
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 272, in init
self.start_session(capabilities, browser_profile)
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 364, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 429, in execute
self.error_handler.check_response(response)
File "C:\Users\24928\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
Stacktrace:
Backtrace:
Process finished with exit code 1