title: Selenium TimeoutException with Flask and Python
body: <p>This is what my code looks like</p>
  <pre><code>@app.route(&quot;/Committ&quot;, methods=['GET', 'POST']) 
  def Committ():
    ......
    if(......):
      #do sthg
      firefox_profile = webdriver.FirefoxProfile()
      firefox_profile.set_preference(&quot;browser.priavtebrowsing.autostart&quot;,True)
      driver = webdriver.Firefox(firefox_profile = firefox_profile)
      driver.get(&quot;https://www.instagram.com&quot;)
      assert &quot;Instagram&quot; in driver.title
      ......
      driver.close()
  </code></pre>
  <p>After running the code above for a number a time usually at the 2nd or third time I get the following error:
  <a href="https://i.stack.imgur.com/mJMTx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mJMTx.png" alt="condtion 1" /></a></p>
  <p>I try add a try and except to avoid this from happening but it didn't rly workout.</p>
  <p><a href="https://i.stack.imgur.com/wkRLH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wkRLH.png" alt="UnboundLocalError" /></a></p>