
    Eg                         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 dd	lmZ ej                                        Z G d
 de
          Z	dS )    N)WebDriverException)DesiredCapabilities)	WebDriver   )Options)SafariRemoteConnection)DEFAULT_EXECUTABLE_PATH)Servicec            	       `     e Zd ZdZdededddddf	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.r   FTNoptionsservicereturnc
                    |rt          j        dt          d           |t          k    rt          j        dt          d           |rt          j        dt          d           |t          k    rt          j        dt          d           |rt          j        dt          d           |st          j        dt          d           |rt          j        d	t          d           || _        |	pt          ||||
          | _        |s| j                                         t          | j        j
        |          }
t                                          |
|           d| _        dS )a  Creates a new Safari driver instance and launches or finds a running
        safaridriver service.

        :Args:
         - port - The port on which the safaridriver service should listen for new connections. If zero, a free port will be found.
         - executable_path - Path to a custom safaridriver executable to be used. If absent, /usr/bin/safaridriver is used.
         - reuse_service - If True, do not spawn a safaridriver instance; instead, connect to an already-running service that was launched externally.
         - desired_capabilities: Dictionary object with desired capabilities (Can be used to provide various Safari switches).
         - quiet - If True, the driver's stdout and stderr is suppressed.
         - keep_alive - Whether to configure SafariRemoteConnection to use
             HTTP keep-alive. Defaults to True.
         - service_args : List of args to pass to the safaridriver service
         - service - Service object for handling the browser driver if you need to pass extra details
        z=port has been deprecated, please set it via the service class   )
stacklevelzKexecutable_path has been deprecated, please use the Options class to set itzIreuse_service has been deprecated, please use the Service class to set itzPdesired_capabilities has been deprecated, please use the Options class to set itzAquiet has been deprecated, please use the Service class to set itzFkeep_alive has been deprecated, please use the Service class to set itzHservice_args has been deprecated, please use the Service class to set it)portquietservice_args)remote_server_addr
keep_alive)command_executorr   FN)warningswarnDeprecationWarningr	   DEFAULT_SAFARI_CAPS_reuse_servicer
   r   startr   service_urlsuper__init__
_is_remote)selfr   executable_pathreuse_servicedesired_capabilitiesr   r   r   r   r   executor	__class__s              X/var/www/sysmax/venv/lib/python3.11/site-packages/selenium/webdriver/safari/webdriver.pyr    zWebDriver.__init__$   s   4  	MOQcpq    555M]"   
  	M["   
  #666Mb"   
  	MSUgtu     	MX"     	MZ"    ,m'/E`l"m"m"m 	!L   )T\=Ublmmm(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.quitr   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   sS    %&& 	d$%bccc#
&(@AAAAAr)   c                     |                      d          d         }|d         }|sd S ||vrd S ||         }t          |t                    sd S |S )NGET_PERMISSIONSr6   r1   )r4   r2   r3   )r"   r5   r7   r1   r6   s        r(   get_permissionzWebDriver.get_permission   sf    ,,011':m, 	4[((4J'%&& 	4r)   c                 Z    |                      d           |                     d           d S )NATTACH_DEBUGGERz	debugger;)r4   execute_script)r"   s    r(   debugzWebDriver.debug   s/    &'''K(((((r)   )__name__
__module____qualname____doc__r	   r   r   r
   r    r+   r8   r;   r?   __classcell__)r'   s   @r(   r   r   !   s        HH /0L  L  L  L  
L  L  L  L  L  L \	$ 	$ 	$ 	$ 	$B B B   ) ) ) ) ) ) )r)   r   )http.clientclientr,   r   selenium.common.exceptionsr   .selenium.webdriver.common.desired_capabilitiesr   #selenium.webdriver.remote.webdriverr   RemoteWebDriverr   r   remote_connectionr   r   r	   r
   SAFARIcopyr    r)   r(   <module>rO      s   $ " ! ! ! ! !  9 9 9 9 9 9 N N N N N N L L L L L L       5 5 5 5 5 5 , , , , , ,      )05577 {) {) {) {) {) {) {) {) {) {)r)   