Traceback (most recent call last): File "C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\driver_finder.py", line 42, in get_path path = SeleniumManager().driver_location(options) if path is None else path File "C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 96, in driver_location result = self.run(args) File "C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\selenium_manager.py", line 121, in run raise WebDriverException(f"Unsuccessful command executed: {command}.\n{result}{stderr}") selenium.common.exceptions.WebDriverException: Message: Unsuccessful command executed: C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output json. error sending request for url (https://chromedriver.storage.googleapis.com/LATEST_RELEASE_49): error trying to connect: dns error: 这是在主机名解析时通常出现的暂时错误,它意味着本地服务器没有从权威服务器上收到响应。 (os error 11002) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\jzhcc\Desktop\222.py", line 3, in <module> browser = webdriver.Chrome() File "C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 47, in __init__ self.service.path = DriverFinder.get_path(self.service, self.options) File "C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\driver_finder.py", line 44, in get_path raise NoSuchDriverException(f"Unable to obtain {service.path} using Selenium Manager; {err}") selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain chromedriver using Selenium Manager; Message: Unsuccessful command executed: C:\Users\jzhcc\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output json. error sending request for url (https://chromedriver.storage.googleapis.com/LATEST_RELEASE_49): error trying to connect: dns error: 这是在主机名解析时通常出现的暂时错误,它意味着本地服务器没有从权威服务器上收到响应。 (os error 11002) ; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
时间: 2023-07-24 10:14:55 浏览: 453
浅谈Python traceback的优雅处理
这个错误通常是由于网络连接问题导致的。在使用Selenium时,webdriver需要下载和使用适合您的Chrome浏览器版本的chromedriver,但是它无法连接到chromedriver下载地址。这可能是由于网络问题或防火墙设置引起的。
您可以尝试以下几种方法来解决问题:
1. 检查网络连接:确保您的计算机可以访问互联网,并且没有任何防火墙或代理设置阻止了对chromedriver下载地址的访问。
2. 手动下载chromedriver:您可以手动从Chrome官方网站(https://sites.google.com/a/chromium.org/chromedriver/)下载适用于您的Chrome浏览器版本的chromedriver,并将其放置在您的系统路径中。
3. 使用selenium_manager库:根据错误信息,您正在使用`selenium_manager`库来管理webdriver位置。请确保您已正确安装和配置了该库,并且它能够找到正确的webdriver位置。
希望这些解决方案对您有帮助!如果问题仍然存在,请提供更多详细信息,以便我能够更好地帮助您解决问题。
阅读全文