Skip to content Skip to sidebar Skip to footer

Runtimeerror: Failed To Shutdown The Live Test Server In 2 Seconds. The Server Might Be Stuck Or Generating A Slow Response. - Django

I am getting this error with Django RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response. I am trying to run

Solution 1:

The error you are seeing is associated with the clean-up code found in SeleniumTests.tearDownClass(cls). Within that method, if you call cls.driver.quit() before you call super(SeleniumTests, cls).tearDownClass() the error will go away.

Solution 2:

I know my solution is not the correct way to do this, but this is what worked for me in the end:

First of all, I flipped the method calls in the tear down class, as suggested by diliop:

@classmethoddeftearDownClass(cls):
    super(SeleniumTests, cls).tearDownClass()
    cls.driver.quit() 

However, this created another error: [Errno 10054] An existing connection was forcibly closed by the remote host. Everything worked fine, website closed, all tests passed, but this error appeared at the end.

I noticed that if I go to another page and try to close my website from that page (instead of the initial main page), the error disappears. So I put the following in the tearDown:

deftearDown(self):
    #go to main pageself.driver.get('%s%s' % (self.live_server_url, '/testingDB/'))
    #find the first button
    elemOptionSet = self.driver.find_element_by_id("optionSetPage")
    #click it
    elemOptionSet.click()

Afterwards, when selenium tries to close the website, there are no errors. If anyone can explain this behavior, it would be great! But until then, this will do.

Post a Comment for "Runtimeerror: Failed To Shutdown The Live Test Server In 2 Seconds. The Server Might Be Stuck Or Generating A Slow Response. - Django"