path变量是已经设置好了的
变量是没有问题的可以执行
但是当我从代码执行是
from selenium import webdriver
path = "/usr/local/bin/chromedriver" # 注意这个路径需要时可执行路径(chmod 777 dir or 755 dir)
driver = webdriver.Chrome(path)
执行的时候自己跑去/Applications/Googl目录下面找了
导致版本不对无法使用
报错信息如下
/usr/local/bin/python3.8 /Users/xxm/study/爬虫/demo1.py
Traceback (most recent call last):
File "/Users/xxm/study/爬虫/demo1.py", line 4, in <module>
driver = webdriver.Chrome(path)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
RemoteWebDriver.__init__(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 89
Current browser version is 88.0.4324.146 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Process finished with exit code 1