o
    ҷh>                     @   sp   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 deZdS )    N)WebDriverException)	WebDriver   )DriverFinder   )Options)SafariRemoteConnection)Servicec                       s\   e Zd ZdZ				ddededdf fdd	Z fd
dZdd Zdd Z	dd Z
  ZS )r   z>Controls the SafariDriver and allows you to drive the browser.FTNoptionsservicereturnc                    s   |r
t jdtdd |r|nt | _|r|nt }t| j|| j_|o'| jj	| _
| j
s1| j  t| jj||jd}t j||d 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__ V/var/www/html/venv/lib/python3.10/site-packages/selenium/webdriver/safari/webdriver.pyr   !   s&   

zWebDriver.__init__c                    sT   zzt    W n
 tjy   Y nw W | js| j  dS dS | js)| j  w 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!   r#   r$   r%   L   s   
zWebDriver.quitc                 C   s.   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payloadr#   r#   r$   set_permission[   s   
zWebDriver.set_permissionc                 C   sD   |  dd }|d }|sd S ||vrd S || }t|ts d S |S )NGET_PERMISSIONSr0   r+   )r.   r,   r-   )r   r/   r1   r+   r0   r#   r#   r$   get_permissionc   s   
zWebDriver.get_permissionc                 C   s   |  d | d d S )NATTACH_DEBUGGERz	debugger;)r.   execute_scriptr)   r#   r#   r$   debugs   s   
zWebDriver.debug)FTNN)__name__
__module____qualname____doc__r   r	   r   r%   r2   r4   r7   __classcell__r#   r#   r!   r$   r      s"    +r   )http.clientclientr&   r   selenium.common.exceptionsr   #selenium.webdriver.remote.webdriverr   RemoteWebDrivercommon.driver_finderr   r
   r   remote_connectionr   r   r	   r#   r#   r#   r$   <module>   s   