U
    g8
                     @   s,   d dl mZ G dd dZG dd dZdS )   )Commandc                   @   s8   e Zd Zdd Zedd Zedd Zedd Zd	S )
_ConnectionTypec                 C   s
   || _ d S )Nmask)selfr    r   D/tmp/pip-unpacked-wheel-3ysq0mf8/selenium/webdriver/remote/mobile.py__init__   s    z_ConnectionType.__init__c                 C   s   | j d dkS N   r   r   r   r   r   r   airplane_mode   s    z_ConnectionType.airplane_modec                 C   s   | j d d dkS r
   r   r   r   r   r   wifi   s    z_ConnectionType.wific                 C   s   | j d dkS )N       r   r   r   r   r   data!   s    z_ConnectionType.dataN)__name__
__module____qualname__r	   propertyr   r   r   r   r   r   r   r      s   

r   c                   @   sx   e Zd Ze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jddddZe
dd ZdS )Mobile   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)ConnectionTyper   executer   ZGET_NETWORK_CONNECTIONr   r   r   r   network_connection2   s    zMobile.network_connectionc                 C   s:   t || jr|jn|}| | jtjdd|idd S )zSet 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_connection6   s     zMobile.set_network_connectionc                 C   s   | j tjS )z0Returns the current context (Native or WebView).)r   r   r   ZCURRENT_CONTEXT_HANDLEr   r   r   r   contextD   s    zMobile.contextN)returnc                 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&   I   s    c                 C   s   | j tjS )z%Returns a list of available contexts.)r   r   r   ZCONTEXT_HANDLESr   r   r   r   contextsN   s    zMobile.contexts)r   r   r   r   r   ZALL_NETWORKZWIFI_NETWORKZDATA_NETWORKZAIRPLANE_MODEr	   r   r   r%   r&   setterr(   r   r   r   r   r   &   s   

r   N)commandr   r   r   r   r   r   r   <module>   s   