title: Python Selenium. How to use driver.set_page_load_timeout() properly?
body: <pre><code>from selenium import webdriver
  
  driver = webdriver.Chrome()
  driver.set_page_load_timeout(7)
  
  def urlOpen(url):
      try:
          driver.get(url)
          print driver.current_url
      except:
          return
  </code></pre>
  
  <p>Then I have URL lists and call above methods.</p>
  
  <pre><code>if __name__ == "__main__":
      urls = ['http://motahari.ir/', 'http://facebook.com', 'http://google.com']
      # It doesn't print anything
  
      # urls = ['http://facebook.com', 'http://google.com', 'http://motahari.ir/'] 
      # This prints https://www.facebook.com/ https://www.google.co.kr/?gfe_rd=cr&amp;dcr=0&amp;ei=3bfdWdzWAYvR8geelrqQAw&amp;gws_rd=ssl
  
      for url in urls:
          urlOpen(url)
  </code></pre>
  
  <p>The problem is when website '<a href="http://motahari.ir/" rel="noreferrer">http://motahari.ir/</a>' throws Timeout Exception, websites '<a href="http://facebook.com" rel="noreferrer">http://facebook.com</a>' and '<a href="http://google.com" rel="noreferrer">http://google.com</a>' always throw Timeout Exception. </p>
  
  <p>Browser keeps waiting for 'motahari.ir/' to load. But the loop just goes on (It doesn't open 'facebook.com' but wait for 'motahari.ir/') and keep throwing timeout exception</p>
  
  <p>Initializing a webdriver instance takes long, so I pulled that out of the method and I think that caused the problem. Then, should I always reinitialize webdriver instance whenever there's a timeout exception? And How? (Since I initialized driver outside of the function, I can't reinitialize it in except)</p>