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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:39:29+00:00 2026-06-09T22:39:29+00:00

I am trying to run selenium tests I’ve written for a Django project on

  • 0

I am trying to run selenium tests I’ve written for a Django project on a Debian server, using xvfb.

I have 3 tests I am trying to run, after the first test, they fail with this error:
NoSuchElementException: Message: u’Unable to locate element: {"method":"xpath","selector":"//a[@href=\\"#detail\\"]"}'

I have run export DISPLAY=:99 and am using Django LiveServerTestCase with django-selenium.
SELENIUM_DISPLAY = ':99' is set in my settings.py.

Here is my test runner:

class BaseLiveTest(LiveServerTestCase):
    @classmethod
    def setUpClass(cls):
        cls.selenium = WebDriver()
        super(BaseLiveTest, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(BaseLiveTest, cls).tearDownClass()
        cls.selenium.quit()

    def login(self, user):
        #helper function, to log in users
        #go to login page
        self.selenium.get("%s%s" % (self.live_server_url, reverse('userena_signin')))
        #wait for page to display
        WebDriverWait(self.selenium, 10).until(
            lambda x: self.selenium.find_element_by_id('id_identification'),
        )
        #fill in form and submit
        identifictation_input = self.selenium.find_element_by_id('id_identification')
        identifictation_input.send_keys(user.email)
        password_input = self.selenium.find_element_by_id("id_password")
        password_input.send_keys('password')
        self.selenium.find_element_by_xpath('//form/descendant::button[@type="submit"]').click()

        #wait for dashboard to load
        WebDriverWait(self.selenium, 10).until(
            lambda x: self.selenium.find_element_by_id('container'),
        )

When I run each test by itself they all pass, but if I try to run them one after another the last 2 fail. Any ideas?

  • 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-09T22:39:31+00:00Added an answer on June 9, 2026 at 10:39 pm

    You need to use setUp() and tearDown(), not setUpClass() and tearDownClass(). The Class versions are run globally for the entire fixture, so all 3 tests are using the same WebDriver instance, and thus the browser isn’t in the state you expect for your second and third tests.

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

Sidebar

Related Questions

I'm trying to run Selenium tests for a Django app on production server. I
I am trying to run selenium tests as part of build. I have a
I am trying to run a series of HTML selenium tests using the selenese
I have chrome installed in my system. I'm using Selenium to run some tests
I'm using Jenkins with Ant plug-in to run PHPUnit/Selenium tests. I'm trying to set
I'm trying to run Selenium tests with Selenium-RC using TestNG on Eclipse. When I
I'm trying to run a series of selenium tests using maven and I get
i am trying to run selenium tests as part of maven build , so
i am trying to run selenium tests as part of maven build, and this
I am trying to get Hudson to run my ruby based selenium tests. I

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.