Milano
Milano

Reputation: 18735

Xvfbwrapper module returns exception

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.)

Upvotes: 1

Views: 543

Answers (1)

user2687058
user2687058

Reputation: 166

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.

Upvotes: 2

Related Questions