在Django app上运行selenium测试时出现间歇性管道错误

时间:2016-04-13 22:35:37

标签: python ajax django selenium

我正在使用带有Django 1.4版的LiveServerTestCase,用于selenium 2.53.1的python绑定,Linux上的Firefox 45.0.1测试我的Django应用程序。

我发现此管道损坏的错误与此question类似。我已经看过webdriver并将其缩小到看起来似乎是在WebDriver在页面(有一些ajax组件)已经完全加载之前结束得太快的时候。

1)即使我只进行了一次测试,也会发生这种情况,因此不会在测试之间断开管道。
2)对于加载不同页面的所有按钮点击,我添加了一个明确的等待特定的ajax组件,似乎没有加载 3)还添加了30秒的整体page_load_timeout。

即使在所有这些之后我仍然间歇性地得到这个错误并且在我的智慧结束时,有任何建议吗?

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

0 个答案:

没有答案