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 6924983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:43:52+00:00 2026-05-27T10:43:52+00:00

So I am running Selenium on a Ubuntu Server VM and have a minor

  • 0

So I am running Selenium on a Ubuntu Server VM and have a minor issue. When I start-up my VM and run a Selenium test script I get this error: selenium.common.exceptions.WebDriverException: Message: ‘The browser seems to have exited before we could connect’. Now if I execute this export DISPLAY=:99 in the terminal before I run any of my Selenium test scripts all works fine. All tests run great headlessly!

My questions is do any of you know how to execute this command on start-up. So I don’t have to run this in the terminal before I run my Selenium test scripts. I’ve tried adding it to the /etc/rc.local file. But this doesn’t seem to work.

I’ve also tried executing it at the beginning of my Selenium test scripts. By just adding this (I’m using python)

os.system("export DISPLAY=:99")

Any suggestions as to how to accomplish this?
Thanks in advance

  • 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-05-27T10:43:53+00:00Added an answer on May 27, 2026 at 10:43 am

    This isn’t going to work:

    os.system("export DISPLAY=:99")
    

    Because system() starts a new shell and the shell will close when finished, this influences the environment of exactly one process that is very short lived. (Child processes cannot influence the environments of their parents. Parents can only influence the environment of their children, if they make the change before executing the child process.)

    You can pick a few different mechanisms for setting the DISPLAY:

    • Set it in the scripts that start your testing mechanism

      This is especially nice if the system might do other tasks, as this will influence as little as possible. In Python, that would look like:

      os.environ["DISPLAY"]=":99"
      

      In bash(1), that would look like:

      export DISPLAY=:99
      
    • Set it in the login scripts of the user account that runs the tests.

      This is nice if the user account that runs the tests will never need a DISPLAY variable. (Though if a user logs in via ssh -X testinguser@machine ... this will clobber the usual ssh(1) X session forwarding.)

      Add this to your user’s ~/.bashrc or ~/.profile or ~/.bash_profile. (See bash(1) for the differences between the files.)

      export DISPLAY=:99
      
    • Set it at login for all users. This is nice if multiple user accounts on the system will be running the testing scripts and you just want it to work for all of them. You don’t care about users ever having a DISPLAY for X forwarding.

      Edit /etc/environment to add the new variable. The pam_env(8) PAM module will set the environment variables for all user accounts that authenticate under whichever services are configured to use pam_env(8) in the /etc/pam.d/ configuration directory. (This sounds more complicated than it is — some services want authenticated users to have environment variables set, some services don’t.)

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

Sidebar

Related Questions

I am running Selenium Server. I'm also launching an automated test script that I
I got this error , while running selenium script for Internet Explorer 9. Exception
I have Selenium running under Cruise Control to test our site once a day.
i have a (i guess) simple question. I am running Selenium test cases (HTML,
I am currently running Selenium commands through PHPUnit to a remote server. I've run
I exported a working Selenium test case to Java, running it via selenium-rc's selenium-server.jar
Getting this error when running pip install -U selenium . Mid way through the
Running a Selenium 2 RemoteWebDriver server using java -jar selenium-server-standalone-2.15.0.jar . I always get
We have a headless selenium running as part of a maven build script using
I am running a ubuntu server with apache/php/mysql. I want to use selenium on

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.