title: Setting timeout on selenium webdriver.PhantomJS
body: <p><em><strong>The situation</em></strong></p>
  
  <p>I have a simple python script to get the HTML source for a given url:</p>
  
  <pre><code>    browser = webdriver.PhantomJS()
      browser.get(url)
      content = browser.page_source
  </code></pre>
  
  <p>Occasionally, the url points to a page with slow-loading external resources (e.g. video files, or really slow advertising content).</p>
  
  <p>Webdriver will wait until those resources are loaded before completing the <code>.get(url)</code> request.</p>
  
  <p>Note: For extraneous reasons, I need to do this with PhantomJS rather than <code>requests</code> or <code>urllib2</code></p>
  
  <hr>
  
  <p><em><strong>The question</em></strong></p>
  
  <p>I'd like to set a timeout on PhantomJS resource loading so that if the resource is taking too long to load, the browser just assumes it doesn't exist or whatever.</p>
  
  <p>This would allow me to perform the subsequent <code>.pagesource</code> query based on what the browser has loaded.</p>
  
  <p><a href="http://selenium.googlecode.com/svn/trunk/docs/api/py/webdriver_phantomjs/selenium.webdriver.phantomjs.webdriver.html" rel="noreferrer">Documentation</a> on webdriver.PhantomJS is very thin, and I haven't found a similar question on SO.</p>
  
  <p>thanks in advance! </p>