
    ,h                     b    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)    )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.Noptionsservicereturnc                    |r|n	t               | _        |r|n	t               }| j                  j                         xs$ t	        | j                  |      j                         | j                  _        | j                  j                  s| j                  j                          t        | j                  j                  ||j                        }	 t        | 5  ||       d| _        y# t        $ r | j                           w xY w)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   env_pathr   get_driver_pathpathreuse_servicestartr	   service_url_ignore_local_proxysuper__init__	Exceptionquit
_is_remote)selfr   r   r   executor	__class__s        e/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/selenium/webdriver/safari/webdriver.pyr   zWebDriver.__init__   s     #*wwy$'') LL113l|DLLRY7Z7j7j7l||))LL )#||77! 44
	GhH
  	  	IIK	s   C( (Dc                    	 t         |           | j                  j                  s| j                  j                          yy# t        $ r Y =w xY w# | j                  j                  s| j                  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   sn    	$GLN
 <<--!!# .	  		 <<--!!# .s#   A 	AA AA 3B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_permissionR   s6    %&$%bccu%&(@A    c                 t    | j                  d      d   }|d   }|sy ||vry ||   }t        |t              sy |S )NGET_PERMISSIONSr-   r(   )r+   r)   r*   )r    r,   r.   r(   r-   s        r#   get_permissionzWebDriver.get_permissionZ   sM    ,,01':m,[(J'%&r0   c                 H    | j                  d       | j                  d       y )NATTACH_DEBUGGERz	debugger;)r+   execute_script)r    s    r#   debugzWebDriver.debugj   s    &'K(r0   )TNN)__name__
__module____qualname____doc__r   r
   r   r   r/   r3   r7   __classcell__)r"   s   @r#   r   r      sJ    H 	#  #  	# 
 
# J	$B )r0   r   N)selenium.common.exceptionsr   #selenium.webdriver.remote.webdriverr   RemoteWebDrivercommon.driver_finderr   r   r   remote_connectionr	   r   r
    r0   r#   <module>rC      s'   $ : L /  5 Q) Q)r0   