title: How to avoid a socket timeout for selenium webdriver?
body: <p>I am having a complex python-selenium test suite to test a non-public webpage. In that setup I need to get the webdriver like follows: </p>
  
  <pre><code>self.driver = webdriver.Firefox(firefox_profile = profile, log_path = logfile)
  </code></pre>
  
  <p>with some profile and log path. In most cases this line of code just works fine, but sometimes (5% or the cases) I get a socket timeout error:</p>
  
  <pre><code>File "/root/tests/usecase_tests/tools/basicsuite.py", line 213, in set_driver_firefox
      self.driver = webdriver.Firefox(firefox_profile = profile, log_path = logfile)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 158, in __init__
      keep_alive=True)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
      self.start_session(desired_capabilities, browser_profile)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
      response = self.execute(Command.NEW_SESSION, parameters)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 309, in execute
      response = self.command_executor.execute(driver_command, params)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 460, in execute
      return self._request(command_info[0], url, body=data)
    File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 484, in _request
      resp = self._conn.getresponse()
    File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
      response.begin()
    File "/usr/lib/python2.7/httplib.py", line 453, in begin
      version, status, reason = self._read_status()
    File "/usr/lib/python2.7/httplib.py", line 409, in _read_status
      line = self.fp.readline(_MAXLINE + 1)
    File "/usr/lib/python2.7/socket.py", line 480, in readline
      data = self._sock.recv(self._rbufsize)
  timeout: timed out
  </code></pre>
  
  <p>What could be a possible cause of this error? How to debug this error? How to fix it? </p>