o
    US`cy
  ã                   @   s   d dl mZ G dd„ dƒZdS )é   )ÚCommandc                   @   s~   e Zd ZG dd„ dƒZedƒZedƒZedƒZedƒZdd„ Ze	d	d
„ ƒZ
dd„ Ze	dd„ ƒZe	dd„ ƒZejddd„ƒZdS )ÚMobilec                   @   s8   e Zd Zdd„ Zedd„ ƒZedd„ ƒZedd„ ƒZd	S )
zMobile.ConnectionTypec                 C   s
   || _ d S )N©Úmask)Úselfr   © r   úK/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/mobile.pyÚ__init__   s   
zMobile.ConnectionType.__init__c                 C   s   | j d dkS ©Né   r   r   ©r   r   r   r   Úairplane_mode   ó   z#Mobile.ConnectionType.airplane_modec                 C   s   | j d d dkS r
   r   r   r   r   r   Úwifi    s   zMobile.ConnectionType.wific                 C   s   | j d dkS )Né   é    r   r   r   r   r   Údata$   r   zMobile.ConnectionType.dataN)Ú__name__Ú
__module__Ú__qualname__r	   Úpropertyr   r   r   r   r   r   r   ÚConnectionType   s    

r   é   r   r   r   c                 C   s   dd l }| |¡| _d S )Nr   )ÚweakrefÚproxyÚ_driver)r   Zdriverr   r   r   r   r	   -   s   zMobile.__init__c                 C   s   |   | j tj¡d ¡S )NÚvalue)r   r   Úexecuter   ZGET_NETWORK_CONNECTIONr   r   r   r   Únetwork_connection1   s   zMobile.network_connectionc                 C   s:   t || jƒr	|jn|}|  | j tjdd|idœ¡d ¡S )z¾
        Set the network connection for the remote device.

        Example of setting airplane mode::

            driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE)
        r   Útype)ÚnameÚ
parametersr   )Ú
isinstancer   r   r   r   r   ZSET_NETWORK_CONNECTION)r   ÚnetworkÚmoder   r   r   Úset_network_connection5   s   
þÿýzMobile.set_network_connectionc                 C   ó   | j  tj¡S )zB
        returns the current context (Native or WebView).
        )r   r   r   ZCURRENT_CONTEXT_HANDLEr   r   r   r   ÚcontextC   ó   zMobile.contextc                 C   r&   )z6
        returns a list of available contexts
        )r   r   r   ZCONTEXT_HANDLESr   r   r   r   ÚcontextsJ   r(   zMobile.contextsÚreturnNc                 C   s   | j  tjd|i¡ dS )z*
        sets the current context
        r    N)r   r   r   ZSWITCH_TO_CONTEXT)r   Znew_contextr   r   r   r'   Q   s   )r*   N)r   r   r   r   ZALL_NETWORKZWIFI_NETWORKZDATA_NETWORKZAIRPLANE_MODEr	   r   r   r%   r'   r)   Úsetterr   r   r   r   r      s     


r   N)Úcommandr   r   r   r   r   r   Ú<module>   s   