o
    ¹i²  ã                   @   sN   d Z ddlmZ ddlmZ ddlmZ G dd„ deƒZddd	„Z	d
d„ Z
dS )z»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.
é    )ÚFirefox)ÚNotebook)Úlist_running_serversc                   @   s   e Zd Zdd„ ZdS )ÚNoServerErrorc                 C   s
   || _ d S )N)Úmessage)Úselfr   © r   úa/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/notebook/tests/selenium/quick_selenium.pyÚ__init__   s   
zNoServerError.__init__N)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r	   r      s    r   Fc              
   C   s€   z	t tƒ ƒd }W n ty } ztdƒ|‚d}~ww tƒ }djdi |¤Ž}| |¡ |j d¡r>| s>| |j 	d¡d ¡ |S )	a#  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()
    r   z9You need a server running before you can run this commandNz{url}?token={token}z/labÚlabÚtreer   )
Úlistr   Ú
IndexErrorr   r   ÚformatÚgetÚcurrent_urlÚendswithÚrstrip)r   ÚserverÚeÚdriverÚauth_urlr   r   r	   Úquick_driver   s   
ÿ€ÿ
r   c                   C   s   t  tƒ ¡S )a  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   Únew_notebookr   r   r   r   r	   Úquick_notebook*   s   r   N)F)Ú__doc__Úselenium.webdriverr   Únotebook.tests.selenium.utilsr   Únotebook.notebookappr   Ú	Exceptionr   r   r   r   r   r   r	   Ú<module>   s    
