[英]selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
I'm new to Python programming, currently learning Selenium so please excuse what may very well be a beginner level question.我是 Python 编程的新手,目前正在学习 Selenium,所以请原谅这很可能是一个初学者级别的问题。
I installed Selenium using Homebrew, then i tried to execute this on my terminal.我使用 Homebrew 安装了 Selenium,然后我尝试在我的终端上执行它。
from selenium import webdriver
webdriver.Chrome()
And then i get this error message.然后我收到此错误消息。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1
I found similar error messages but with a different status code so i can't find a way to solve this be it in the documentation or on StackOverflow.我发现了类似的错误消息,但状态代码不同,因此无论是在文档中还是在 StackOverflow 上,我都找不到解决此问题的方法。
The problem is that you're missing ChromeDriver,问题是您缺少 ChromeDriver,
First, find which version of Chrome are you using:首先,找到您使用的是哪个版本的 Chrome:
Second, find and download the right version of ChromeDriver二、找到并下载正确版本的ChromeDriver
Third, Unzip the package and move it to the usr/local/bin
folder.三、解压package,移动到
usr/local/bin
文件夹下。
( usr/local/bin
path worked for me on macOS, might be different for different OS) (
usr/local/bin
路径在 macOS 上对我有用,对于不同的操作系统可能会有所不同)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.