
    hg                         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mZ ddlmZ ej                                        Z G d	 d
e
          Z	dS )    N)WebDriverException)DesiredCapabilities)	WebDriver   )Options)DEFAULT_EXECUTABLE_PATHService)SafariRemoteConnectionc            	       N    e Zd ZdZdededddddf	dedefdZd	 Z	d
 Z
d Zd ZdS )r   zI
    Controls the SafariDriver and allows you to drive the browser.

    r   FTNoptionsservicec
                    |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           || _        |	r|	| _        nt          ||||
          | _        |s| j                                         t          | j        j
        |          }
t          j        | |
|           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_executordesired_capabilitiesFN)warningswarnDeprecationWarningr   DEFAULT_SAFARI_CAPS_reuse_servicer   r	   startr
   service_urlRemoteWebDriver__init__
_is_remote)selfr   executable_pathreuse_servicer   r   r   r   r   r   executors              \/var/www/fb-scrape/myenv/lib/python3.11/site-packages/selenium/webdriver/safari/webdriver.pyr    zWebDriver.__init__(   s   $  	<MY,< < < < 555Mg,< < < < 	<Me,< < < <#666Ml,< < < < 	<M],< < < < 	<Mb,< < < <  	<Md,< < < < , 	g"DLL"?UYefffDL 	!L   )T\=U5?A A A 	 %!5	7 	7 	7 	7
      c                     	 t          j        |            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)z
        Closes the browser and shuts down the SafariDriver executable
        that is started when starting the SafariDriver
        N)r   quithttp_clientBadStatusLiner   r   stopr"   s    r&   r)   zWebDriver.quitd   s    
	$ &&&&( 	 	 	D	 & $!!#####$ $4& $!!####$s!    A )A )A #A3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_permissionu   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_PERMISSIONSr5   r0   )r3   r1   r2   )r"   r4   r6   r0   r5   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;)r3   execute_scriptr-   s    r&   debugzWebDriver.debug   s/    &'''K(((((r'   )__name__
__module____qualname____doc__r   r   r   r	   r    r)   r7   r:   r>    r'   r&   r   r   "   s         
 /FV[&9 tae:  : >E: W^:  :  :  : x$ $ $"B B B   ) ) ) ) )r'   r   )http.clientclientr*   r   selenium.common.exceptionsr   .selenium.webdriver.common.desired_capabilitiesr   #selenium.webdriver.remote.webdriverr   r   r   r   r   r   r	   remote_connectionr
   SAFARIcopyr   rC   r'   r&   <module>rL      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 5 5 5 5 5 5 5 5 *05577 n) n) n) n) n) n) n) n) n) n)r'   