Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8624391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:31:09+00:00 2026-06-12T07:31:09+00:00

I’m trying to use Python’s Selenium bindings to programmatically interact with websites, as part

  • 0

I’m trying to use Python’s Selenium bindings to programmatically interact with websites, as part of a Django website.

As my Selenium code runs as part of a Django website, by default (if I understand correctly) there is no display available for the browser to use. I’m thus trying to use PyVirtualDisplay to start Xvfb before my Selenium code runs.

Here‘s my code:

from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=False, size=(800, 600))
display.start()

browser = webdriver.Firefox()

When I SSH into my server (running Debian Squeeze, Python 2.6.6, Selenium 2.25, PyVirtualDisplay 0.1.0), run the Python console as myself, and type in the code above, it works fine.

However, when I try to run that code from my Django site, or use su to run the Python console as www-data (which I believe is the user that Django runs as), I get the following error:

selenium.common.exceptions.WebDriverException: Message: 'The browser appears to have exited before we could connect. The output was: 
(process:2963): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.
    Xlib:  extension "RANDR" missing on display ":1082.0".

    (firefox-bin:2963): libgnomevfs-WARNING **: Unable to create ~/.gnome2 directory: Permission denied
    Could not create per-user gnome configuration directory `/var/www/.gnome2/\': Permission denied'

I’m a bit of a noob with Xvfb and Linux, so I’m not quite sure what I’m doing wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:31:10+00:00Added an answer on June 12, 2026 at 7:31 am

    I believe this is a simple permissions error.

    On ubuntu apaches home directory, as you see, is /var/www
    I think you just need to make sure that apache has write access to its home directory. My default on ubuntu 12.04 is

    daniel@daniel:/var/www$ ls -la
    total 12
    drwxr-xr-x  2 root root 4096 Sep 15 11:43 .
    drwxr-xr-x 14 root root 4096 Oct  2 08:54 ..
    -rw-r--r--  1 root root  177 Sep 15 11:43 index.html
    

    www-data does not have write access to its own home directory!

    Perhaps you could have www-data own the directory, or create an admin group that has write permission and add www-data to it?

    Some other threads on giving write access to /var/www
    https://superuser.com/questions/19318/how-can-i-give-write-access-of-a-folder-to-all-users-in-linux

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Selenium (in Python) to extract some information from a website.
I'm trying to use Python to download the HTML source code of a website
I'm trying to use Python to run pdftotext, but for some reason, my code
I am trying to use Python (through Django framework) to make a Linux command
I'm trying to use the Python profiler to speed up my code. I've been
I'm trying to use python to sftp a file, and the code works great
Goal: I'm trying to use python interactively in my c++ code using Boost::Python library.
I'm trying to use Selenium with Python to store the contents of a table.
I'm trying to use Python's getattr() to extract data out of a number of
I am trying to use python shopify api with OAuth2 and working through the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.