关于chromedriver
from selenium import webdriverbrowser=webdriver.Chrome()
browser.get('https://www.baidu.com')
print(browser.page_source)
browser.close()
C:\Users\tiger\PycharmProjects\spider\venv\Scripts\python.exe C:/Users/tiger/PycharmProjects/spider/1.py
Traceback (most recent call last):
File "C:\Users\tiger\PycharmProjects\spider\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\tiger\Anaconda3\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\tiger\Anaconda3\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/tiger/PycharmProjects/spider/1.py", line 3, in <module>
browser=webdriver.Chrome()
File "C:\Users\tiger\PycharmProjects\spider\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\tiger\PycharmProjects\spider\venv\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
大佬们,求解我哪儿有问题 本帖最后由 Twilight6 于 2020-7-21 10:48 编辑
把你的 chromedrver.exe 移动到Python 安装路径下的 Scripts 文件夹下试试看
还有注意谷歌浏览器,和你下载的 chromedrver 版本要一致
把变量加到系统变量里去,不要用账号的环境变量 Twilight6 发表于 2020-7-21 10:47
把你的 chromedrver.exe 移动到Python 安装路径下的 Scripts 文件夹下试试看
还有注意谷歌浏览器, ...
有个问题,我下载的时候只有win32的,这个有影响不 1q23w31 发表于 2020-7-21 10:57
把变量加到系统变量里去,不要用账号的环境变量
拜谢,完美解决了
页:
[1]