Is it possible to run Selenium scripts without having an X server running, too?


Question

I have a python script that uses selenium RC; specifically webdriver.

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.

I've heard of "saucelabs". Is it the best solution?

1
8
2/9/2012 8:53:29 AM

Accepted Answer

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.

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 has also some nice examples.

Also there are lots of questions here on SO for keywords headless, xvfb and selenium. Choose wisely ;)

[Edit]: Here's a nice example.

11
5/23/2017 12:16:58 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon