
     f                     j    d dl mZ d dlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ  G d	 d
e          ZdS )    )WebDriverException)	WebDriver   )DriverFinder   )Options)SafariRemoteConnection)Servicec                   T     e Zd ZdZ	 	 	 ddededdf fdZ fdZd	 Zd
 Z	d Z
 xZS )r   z>Controls the SafariDriver and allows you to drive the browser.TNoptionsservicereturnc                    |r|nt                      | _        |r|nt                      }t          | j        |                                          | j        _        | j        j        s| j                                         t          | j        j	        ||j
                  }	 t                                          ||           n## t          $ r |                                   w xY wd| _        dS )a  Creates a new Safari driver instance and launches or finds a running
        safaridriver service.

        :Args:
         - keep_alive - Whether to configure SafariRemoteConnection to use
             HTTP keep-alive. Defaults to True.
         - options - Instance of ``options.Options``.
         - service - Service object for handling the browser driver if you need to pass extra details
        )remote_server_addr
keep_aliveignore_proxy)command_executorr   FN)r
   r   r   r   get_driver_pathpathreuse_servicestartr	   service_url_ignore_local_proxysuper__init__	Exceptionquit
_is_remote)selfr   r   r   executor	__class__s        f/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/safari/webdriver.pyr   zWebDriver.__init__   s     #*8wwwyy$3'''))(w??OOQQ|) 	!L   )#|7! 4
 
 
	GGhHHHH 	 	 	IIKKK	  s   ##C  C'c                    	 t                                                       n# t          $ r Y nw xY w| j        j        s| j                                         dS dS # | j        j        s| j                                         w w xY w)z>Closes the browser and shuts down the SafariDriver executable.N)r   r   r   r   r   stop)r   r!   s    r"   r   zWebDriver.quitC   s    	$GGLLNNNN 	 	 	D	 <- $!!#####$ $4<- $!!####$s!    $ A 
1A 1A (Bc                     t          |t                    st          d          ||i}|                     dd|i           d S )Nz;Value of a session permission must be set to True or False.SET_PERMISSIONSpermissions)
isinstanceboolr   execute)r   
permissionvaluepayloads       r"   set_permissionzWebDriver.set_permissionR   sN    %&& 	d$%bcccu%&(@AAAAA    c                     |                      d          d         }|d         }|sd S ||vrd S ||         }t          |t                    sd S |S )NGET_PERMISSIONSr,   r'   )r*   r(   r)   )r   r+   r-   r'   r,   s        r"   get_permissionzWebDriver.get_permissionZ   sf    ,,011':m, 	4[((4J'%&& 	4r/   c                 Z    |                      d           |                     d           d S )NATTACH_DEBUGGERz	debugger;)r*   execute_script)r   s    r"   debugzWebDriver.debugj   s/    &'''K(((((r/   )TNN)__name__
__module____qualname____doc__r   r
   r   r   r.   r2   r6   __classcell__)r!   s   @r"   r   r      s        HH 	#  #  #  	# 
 
#  #  #  #  #  # J	$ 	$ 	$ 	$ 	$B B B   ) ) ) ) ) ) )r/   r   N)selenium.common.exceptionsr   #selenium.webdriver.remote.webdriverr   RemoteWebDrivercommon.driver_finderr   r   r   remote_connectionr	   r   r
    r/   r"   <module>rB      s   $ : 9 9 9 9 9 L L L L L L / / / / / /       5 5 5 5 5 5      Q) Q) Q) Q) Q) Q) Q) Q) Q) Q)r/   