Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /home/ubuntu/.cache/selenium/chrome/linux64/116.0.5845.96/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace: #0 0x5566bf874e23
#1 0x5566bf59d7a7
#2 0x5566bf5c850a
#3 0x5566bf5c5a25
#4 0x5566bf605d92
#5 0x5566bf6053af
#6 0x5566bf`
I get the above error only in server, it works perfectly fine in local. My local code is
我只在服务器上得到上述错误,它在本地运行得很好。我的本地代码是
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument('--headless')
options.add_argument('--disable-gpu')
driver = webdriver.Chrome(options=options)
i get the error at the "driver" step in server.
Any solutions ??
我在服务器中的“驱动程序”步骤中得到错误。任何解决方案??
更多回答
优秀答案推荐
I just had this same issue- trying to run selenium on an EC2 instance. It's because the client is headless, so there is a rendering issue. I found the answer in the stack below:
我刚刚遇到了同样的问题--试图在EC2实例上运行Selence。这是因为客户端是无头的,所以存在渲染问题。我在下面的堆栈中找到了答案:
how to make selenium and chromium work on ubuntu
如何让硒和铬在ubuntu上工作
Need to use pyvirtualdisplay to emulate a browser. Make sure you have Xvfb installed:
我需要使用Py VirtualDisplay来模拟浏览器。确保已安装Xvfb:
sudo apt-get install xvfb
更多回答
我是一名优秀的程序员,十分优秀!