1

I'm trying to use a Firefox web driver as a headless driver in Windows - Python. I am using Selenium.

I've tried many things but nothing works so I tried xvfbwrapper which should run Firefox in virtual screen.

from xvfbwrapper import Xvfb

vdisplay = Xvfb()
vdisplay.start()

Returns error:

Traceback (most recent call last):
  File "C:\Users\Milano\My Documents\LiClipse Workspace\Pelikan_bot\pelikan.py", line 20, in <module>
    vdisplay.start()
  File "C:\Python27\lib\site-packages\xvfbwrapper.py", line 48, in start
    self.vdisplay_num = self.search_for_free_display()
  File "C:\Python27\lib\site-packages\xvfbwrapper.py", line 72, in search_for_free_display
    ls = [int(x.split('X')[1].split('-')[0]) for x in self._lock_files()]
  File "C:\Python27\lib\site-packages\xvfbwrapper.py", line 85, in _lock_files
    names = fnmatch.filter(os.listdir(tmpdir), pattern)
WindowsError: [Error 3] The system cannot find the path specified: '/tmp/*.*'

Do you have an idea what I'm doing wrong or do you have a better solution? (I want to keep using Firefox because PhantomJS acts differently so it returns errors which Firefox doesn't.)

Milano
  • 18,048
  • 37
  • 153
  • 353
  • We can also work through the PhantomJS issues you have. Consider asking a separate question about that. – alecxe Jul 12 '15 at 17:24
  • @alecxe Ok, I've uploaded a new question. I put there a method which is loading a whole page with Firefox but with PhantomJS doesn't. http://stackoverflow.com/questions/31371460/phantomjs-acts-differently-than-firefox-webdriver – Milano Jul 12 '15 at 19:03

1 Answers1

2

Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol. Windows does not use X11, you can even see that the python code assumes /tmp, which is a Unix convention.

user2687058
  • 166
  • 1
  • 2
  • 10