不使用xvfb无头运行Selenium [英] Running Selenium headless without using xvfb

查看:138
本文介绍了不使用xvfb无头运行Selenium的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试无头运行Selenium(不显示浏览器).其他问题已指出xvfb作为执行此操作的工具.但是,它似乎非常不稳定,一直崩溃,因此我正在寻找另一种选择.

I'm trying to run Selenium headless (without the browser appearing). Other questions have pointed to xvfb as the tool to do this. However, it appears highly unstable, crashing all the time, so I'm looking for another alternative.

是否有非xvfb方式无头运行Selenium?

Is there a non-xvfb way of running Selenium headless?

推荐答案

我认为如果不运行X服务器,您将无法运行浏览器.

I don't think you'll be able to run a browser without running an X server.

如果您不喜欢Xvfb,那么正如Pascal所说,最好的选择可能是运行VNC服务器-我个人喜欢

If you don't like Xvfb, then as Pascal said, your best bet might be to run a VNC server -- I personally like Xtightvnc. This means you're running a (headless) X server that you can VNC into at any time, in case things go wrong and you want to look at it. I always have a VNC server running, and I'm running my tests with the $DISPLAY environment variable pointing to that server.

(有人不喜欢我,所以也许我应该澄清一下:Xtightvnc之类的X11 VNC服务器与Windows或OS X上的普通VNC服务器不同,它们只是共享网络上的现有屏幕.请不要混淆. -))

(Someone's downvoted me, so maybe I should clarify: X11 VNC servers like Xtightvnc are not the same as the usual VNC servers on Windows or OS X, which would simply share your existing screen on the network. Do not confuse. ;-) )

这篇关于不使用xvfb无头运行Selenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆