
    Fth>                     ~    d dl mZ d dl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 dd	lmZ  G d
 de          ZdS )    N)WebDriverException)	WebDriver   )DriverFinder   )Options)SafariRemoteConnection)Servicec                   V     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.FTNoptionsservicereturnc                    |rt          j        dt          d           |r|nt                      | _        |r|nt                      }t          j        | j        |          | j        _        |o| j        j	        | _
        | j
        s| j                                         t          | j        j        ||j                  }t                                          ||           d| _        dS )a)  Creates a new Safari driver instance and launches or finds a running
        safaridriver service.

        :Args:
         - reuse_service - If True, do not spawn a safaridriver instance; instead, connect to an already-running service that was launched externally.
         - 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
        zIreuse_service has been deprecated, please use the Service class to set itr   )
stacklevel)remote_server_addr
keep_aliveignore_proxy)command_executorr   FN)warningswarnDeprecationWarningr
   r   r   r   get_pathpathreuse_service_reuse_servicestartr	   service_url_ignore_local_proxysuper__init__
_is_remote)selfr   r   r   r   executor	__class__s         w/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/selenium/webdriver/safari/webdriver.pyr    zWebDriver.__init__!   s    "  	M["    #*8wwwyy$3'''))(1$,HH+J0J" 	!L   )#|7! 4
 
 
 	(GDDD    c                    	 t                                                       n# t          j        $ r Y nw xY w| j        s| j                                         dS dS # | j        s| j                                         w w xY w)zuCloses the browser and shuts down the SafariDriver executable that
        is started when starting the SafariDriver.N)r   quithttp_clientBadStatusLiner   r   stop)r"   r$   s    r%   r(   zWebDriver.quitL   s    	$GGLLNNNN( 	 	 	D	 & $!!#####$ $4& $!!####$s!    $ A 6A 6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_permission[   sN    %&& 	d$%bcccu%&(@AAAAAr&   c                     |                      d          d         }|d         }|sd S ||vrd S ||         }t          |t                    sd S |S )NGET_PERMISSIONSr3   r.   )r1   r/   r0   )r"   r2   r4   r.   r3   s        r%   get_permissionzWebDriver.get_permissionc   sf    ,,011':m, 	4[((4J'%&& 	4r&   c                 Z    |                      d           |                     d           d S )NATTACH_DEBUGGERz	debugger;)r1   execute_script)r"   s    r%   debugzWebDriver.debugs   s/    &'''K(((((r&   )FTNN)__name__
__module____qualname____doc__r   r
   r    r(   r5   r8   r<   __classcell__)r$   s   @r%   r   r      s        HH )  )  	) 
 )  
)  )  )  )  )  ) V	$ 	$ 	$ 	$ 	$B B B   ) ) ) ) ) ) )r&   r   )http.clientclientr)   r   selenium.common.exceptionsr   #selenium.webdriver.remote.webdriverr   RemoteWebDrivercommon.driver_finderr   r   r   remote_connectionr	   r   r
    r&   r%   <module>rJ      s   $ " ! ! ! ! !  9 9 9 9 9 9 L L L L L L / / / / / /       5 5 5 5 5 5      W) W) W) W) W) W) W) W) W) W)r&   