ó
ú2˘\c           @   se   d  Z  d d l m Z d d l m Z d d l m Z d e f d     YZ e	 d  Z
 d   Z d	 S(
   sť   Utilities for driving Selenium interactively to develop tests.

These are not used in the tests themselves - rather, the developer writing tests
can use them to experiment with Selenium.
i˙˙˙˙(   t   Firefox(   t   Notebook(   t   list_running_serverst   NoServerErrorc           B   s   e  Z d    Z RS(   c         C   s   | |  _  d  S(   N(   t   message(   t   selfR   (    (    sE   lib/python2.7/site-packages/notebook/tests/selenium/quick_selenium.pyt   __init__   s    (   t   __name__t
   __module__R   (    (    (    sE   lib/python2.7/site-packages/notebook/tests/selenium/quick_selenium.pyR      s   c         C   s   y t  t    d } Wn t k
 r8 } t d   n Xt   } d j |   } | j |  | j j d  r |  r | j | j j	 d  d  n  | S(   s#  Quickly create a selenium driver pointing at an active noteboook server.

    Usage example:
    
        from notebook.tests.selenium.quick_selenium import quick_driver
        driver = quick_driver
        
    Note: you need to manually close the driver that opens with driver.quit()
    i    s9   You need a server running before you can run this commands   {url}?token={token}s   /labt   labt   tree(
   t   listR   t
   IndexErrorR   R    t   formatt   gett   current_urlt   endswitht   rstrip(   R	   t   servert   et   drivert   auth_url(    (    sE   lib/python2.7/site-packages/notebook/tests/selenium/quick_selenium.pyt   quick_driver   s    
	 c           C   s   t  j t    S(   s  Quickly create a new classic notebook in a selenium driver


    Usage example:
    
        from notebook.tests.selenium.quick_selenium import quick_notebook
        nb = quick_notebook()

    Note: you need to manually close the driver that opens with nb.browser.quit()
    (   R   t   new_notebookR   (    (    (    sE   lib/python2.7/site-packages/notebook/tests/selenium/quick_selenium.pyt   quick_notebook*   s    N(   t   __doc__t   selenium.webdriverR    t   notebook.tests.selenium.utilsR   t   notebook.notebookappR   t	   ExceptionR   t   FalseR   R   (    (    (    sE   lib/python2.7/site-packages/notebook/tests/selenium/quick_selenium.pyt   <module>   s   