
    8h>                     v    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y)    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.Noptionsservicereturnc                    |rt        j                  dt        d       |r|n	t               | _        |r|n	t               }t        j                  | j                  |      | j                  _        |xr | j                  j                  | _
        | j                  s| j                  j                          t        | j                  j                  ||j                        }t        | A  ||       d| _        y)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         z/home/stella.sw7ft.com/public_html/site_rebuilder/venv/lib/python3.12/site-packages/selenium/webdriver/safari/webdriver.pyr    zWebDriver.__init__!   s    " MM[" #*wwy$'')(11$,,H+J0J0J""LL )#||77! 44
 	(GD    c                     	 t         |           | j                  s| j
                  j                          yy# t        j                  $ r Y =w xY w# | j                  s| j
                  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   sl    	$GLN &&!!# ' (( 		 &&!!# 's!   9 AA AA )A;c                 j    t        |t              st        d      ||i}| j                  dd|i       y )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[   s6    %&$%bccu%&(@Ar&   c                 t    | j                  d      d   }|d   }|sy ||vry ||   }t        |t              sy |S )NGET_PERMISSIONSr3   r.   )r1   r/   r0   )r"   r2   r4   r.   r3   s        r%   get_permissionzWebDriver.get_permissionc   sM    ,,01':m,[(J'%&r&   c                 H    | j                  d       | j                  d       y )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      sM    H )  	) 
 )  
) V	$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 L /  5 W) W)r&   