title: Selenium Python - Quit if Basic Auth requested
body: <p>I have a script that collects a screenshot of a web site using Selenium. My issue is that if a site requests basic authentication I would like the script to just error and quit.</p>
  
  <p>At the moment it just sits there for about a minute and then takes a blank screen shot.</p>
  
  <p>The code I am using is below.</p>
  
  <pre><code>#!/usr/bin/env python
  
  from pyvirtualdisplay import Display
  from selenium import webdriver
  
  display = Display(visible=0, size=(800, 600))
  display.start()
  
  browser = webdriver.Firefox()
  browser.get('http://www.google.com')
  browser.save_screenshot('screenshot.png')
  browser.quit()
  
  display.stop()
  </code></pre>
  
  <p>I am hoping that there is an easy way of making the script after the browser.get command to error if asked for authentication.</p>
  
  <p>Thanks for your help.</p>