Intermittent intermittent pipe error when running selenium tests in a Django application

I am testing my Django application using LiveServerTestCase with Django version 1.4, Python 2.7, python bindings for selenium 2.53.1, Firefox 45.0.1 on Linux.

I get this broken pipe error similar to this question . I watched the web driver and narrowed it down so it looks like when WebDriver finishes too quickly before the page loads completely (which has some ajax components).

1) This happens even when I run only one of my tests, so this is not related to channel breaks between tests.
2) For all the button presses that load another page, I added an explicit wait for a specific AJAX component that does not seem to load. 3) Also added a general page_load_timeout of 30 seconds.

Even after all this, I periodically get this error, and am I in the end, any suggestions?

Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
    self.finish_response()
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
    self.write(data)
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write
    self.send_headers()
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
    self.send_preamble()
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
    'Date: %s\r\n' % format_date_time(time.time())
  File "/usr/lib/python2.7/socket.py", line 324, in write
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 41308)
Traceback (most recent call last):
  File "/home/jw/.virtualenvs/istame1.4/local/lib/python2.7/site-packages/django/test/testcases.py", line 981, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/jw/.virtualenvs/istame1.4/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 139, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
    self.finish()
  File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
    self.wfile.close()
  File "/usr/lib/python2.7/socket.py", line 279, in close
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
+5
source share

All Articles