是否可以在没有运行X服务器的情况下运行Selenium脚本? [英] Is it possible to run Selenium scripts without having an X server running, too?
问题描述
我有一个使用硒RC的python脚本;特别是webdriver.
I have a python script that uses selenium RC; specifically webdriver.
我希望脚本可以作为提交后的钩子运行,最好是通过IE,Safari(如果可能),Chrome&火狐浏览器.
I would love to have the script run as a post-commit hook, ideally through IE, Safari (if possible), Chrome & Firefox.
但是我不确定我需要做什么,因为每次我在本地计算机上运行它时,都会弹出一个浏览器.
But I'm not sure what I'd need to do, since every time I run it on my local machine, a browser pops up.
我听说过"saucelabs".这是最好的解决方案吗?
I've heard of "saucelabs". Is it the best solution?
推荐答案
是的,您需要运行X服务器,因为Selenium需要运行的浏览器,而浏览器需要某种X服务器才能运行.
Yes, you need to have X server running because Selenium requires a running browser and browsers need some kind of X server in order to run.
幸运的是,X服务器类型很多,其中一种是 Xvfb aka X虚拟帧缓冲区,它在内存中执行所有操作,因此不需要屏幕.
Fortunately there are many types of X servers and one of them is Xvfb aka X virtual framebuffer that does all the operations in memory and thus requires no screen.
Wikipedia也提供了一些不错的示例.
Wikipedia has also some nice examples.
SO上还有很多关于关键字headless
,xvfb
和selenium
的问题.明智地选择;)
Also there are lots of questions here on SO for keywords headless
, xvfb
and selenium
. Choose wisely ;)
这篇关于是否可以在没有运行X服务器的情况下运行Selenium脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!