a
    RIh                     @   sF   d dl mZ d dlmZ d dlmZ G dd dZG dd deZdS )	    )Dict)DesiredCapabilities)
ArgOptionsc                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	_SafariOptionsDescriptora!  _SafariOptionsDescriptor is an implementation of Descriptor protocol:

    : Any look-up or assignment to the below attributes in `Options` class will be intercepted
    by `__get__` and `__set__` method respectively.

    - `automatic_inspection`
    - `automatic_profiling`
    - `use_technology_preview`

    : When an attribute lookup happens,
    Example:
        `self.automatic_inspection`
        `__get__` method does a dictionary look up in the dictionary `_caps` of `Options` class
        and returns the value of key `safari:automaticInspection`
    : When an attribute assignment happens,
    Example:
        `self.automatic_inspection` = True
        `__set__` method sets/updates the value of the key `safari:automaticInspection` in `_caps`
        dictionary in `Options` class.
    c                 C   s   || _ || _d S N)nameexpected_type)selfr   r    r
   [/var/www/html/venv_bot_3.9/lib/python3.9/site-packages/selenium/webdriver/safari/options.py__init__-   s    z!_SafariOptionsDescriptor.__init__c                 C   s*   | j dkr|jd| j kS |j| j S )NSafari Technology PreviewbrowserName)r   _capsget)r	   objclsr
   r
   r   __get__1   s    
z _SafariOptionsDescriptor.__get__c                 C   sR   t || js"t| j d| j | jdkrB|r6| jnd|jd< n||j| j< d S )Nz must be of type r   Zsafarir   )
isinstancer   	TypeErrorr   r   )r	   r   valuer
   r
   r   __set__6   s
    
z _SafariOptionsDescriptor.__set__N)__name__
__module____qualname____doc__r   r   r   r
   r
   r
   r   r      s   r   c                   @   sP   e Zd ZdZdZdZeeeZeeeZ	eeeZ
eeeef dddZdS )Optionszsafari:automaticInspectionzsafari:automaticProfilingr   )returnc                 C   s
   t j S r   )r   ZSAFARIcopy)r	   r
   r
   r   default_capabilitiesq   s    zOptions.default_capabilitiesN)r   r   r   ZAUTOMATIC_INSPECTIONZAUTOMATIC_PROFILINGZSAFARI_TECH_PREVIEWr   boolZautomatic_inspectionZautomatic_profilingZuse_technology_previewpropertyr   strr   r
   r
   r
   r   r   ?   s   


r   N)typingr   Z.selenium.webdriver.common.desired_capabilitiesr   Z!selenium.webdriver.common.optionsr   r   r   r
   r
   r
   r   <module>   s   (