错误:无法打开显示:: 0 Geckodriver硒

发布于 2025-02-08 00:05:15 字数 1690 浏览 3 评论 0原文

我正在尝试运行一个烧瓶应用程序,当用户输入一个链接时,它将运行带有该链接的硒脚本,然后返回一些信息。我正在尝试立即部署它,但是在设置X服务器方面遇到了一些问题。几天前,这很好,不确定为什么它停止工作。 输入URL时,硒会遇到错误,而GeckodriverLog文件说:

1655398364982   geckodriver INFO    Listening on 127.0.0.1:60701
1655398365537   mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "--marionette" "--remote-debugging-port" "57429" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofileqf4HKQ"
No protocol specified
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0

我尝试了 this 帖子告诉我通过虚拟帧缓冲区运行服务器,但这样做似乎根本没有帮助。 我还尝试了的解决方案我的显示变量的整个IP也给了我相同的错误,还带有一个新错误:

1655398078139   geckodriver INFO    Listening on 127.0.0.1:60065
1655398078684   mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "--marionette" "--remote-debugging-port" "48811" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofilelQkVrP"
Unable to init server: Broadway display type not supported: (my_servers_ip):0
Error: cannot open display: (my_servers_ip):0

命令使用:/home/home/dummy/project/venv/bin/gunicorn -chdir/home/home/home/home/dummy/project -w 9 main:app

I'm trying to run a flask application that when the user inputs a link it runs a selenium script with that link and then returns some info. I'm in the process of trying to deploy it right now but running into some issues with setting up the X server. This was working fine a couple days ago not sure why it stopped working.
When entering a url selenium runs into an error and the geckodriverlog file says this:

1655398364982   geckodriver INFO    Listening on 127.0.0.1:60701
1655398365537   mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "--marionette" "--remote-debugging-port" "57429" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofileqf4HKQ"
No protocol specified
Unable to init server: Could not connect: Connection refused
Error: cannot open display: :0

I tried the solution in this post which tells me to run the server through a virtual frame buffer but doing that didn't seem to help at all.
I also tried the solution in this post but writing the whole ip for my display variable gives me the same error with also a new error:

1655398078139   geckodriver INFO    Listening on 127.0.0.1:60065
1655398078684   mozrunner::runner   INFO    Running command: "/usr/bin/firefox" "--marionette" "--remote-debugging-port" "48811" "--remote-allow-hosts" "localhost" "-no-remote" "-profile" "/tmp/rust_mozprofilelQkVrP"
Unable to init server: Broadway display type not supported: (my_servers_ip):0
Error: cannot open display: (my_servers_ip):0

command used: /home/dummy/project/venv/bin/gunicorn --chdir /home/dummy/project -w 9 main:app

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声无音无过去 2025-02-15 00:05:16

我认为框架缓冲区应该是正确的方法,问题可能是您使用的命令。尝试以下命令:

xvfb-run -d -s '-screen 0 1920x1080x24' /home/dummy/project/venv/bin/gunicorn --chdir /home/dummy/project -w 9 main:app  # remove -d option or use -a option instead

I think the frame buffer should be the right method, the problem maybe the command you use. Try the following command:

xvfb-run -d -s '-screen 0 1920x1080x24' /home/dummy/project/venv/bin/gunicorn --chdir /home/dummy/project -w 9 main:app  # remove -d option or use -a option instead
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文