title: How to reopen selenium browser in a loop: Python
body: <p>I'm trying to close the browser and reopen it after a loop</p>
  <pre><code>class Bot():
  
  driver = webdriver.Chrome(options=chrome_options)
  
      def __init__(self):
          self.openyoutube
          self.quitbrowser()
  
      def openyoutube(self):
          self.driver.get('https://www.youtube.com')
          sleep(5)
     
      def quitbrowser(self):
          self.driver.quit()
  
  
  
  def main():
      while True: 
          my_bot = Bot()
          sleep(15)
  
  if __name__ == '__main__':
      main()
  </code></pre>
  <p>But once it tries to start all over, it throws this error:</p>
  <blockquote>
  <p>raise MaxRetryError(_pool, url, error or ResponseError(cause))
  urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost',
  port=64578): Max retries exceeded with url:
  /session/f7fcdfe14c3e2c75d530b3cbf70348d2/url (Caused by
  NewConnectionError('&lt;urllib3.connection.HTTPConnection object at
  0x7fb6d71f8250&gt;: Failed to establish a new connection: [Errno 61]
  Connection refused'))</p>
  </blockquote>