a
    5ñ»jJ  ã                   @   sR   d dl mZ d dl mZ d dlmZ G dd„ dƒZG dd„ dƒZG dd	„ d	ƒZd
S )é    )ÚDict)ÚList)Úcommand_builderc                   @   s    e Zd ZdZdZdZdZdZdS )ÚClientWindowStatezRepresents a window state.Z
fullscreenZ	maximizedZ	minimizedÚnormalN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z
FULLSCREENZ	MAXIMIZEDZ	MINIMIZEDZNORMAL© r   r   úLE:\soccer\ml_env\Lib\site-packages\selenium/webdriver/common/bidi/browser.pyr      s
   r   c                   @   s    e Zd ZdZeeeeeeedœdd„Zedœdd„Zedœdd	„Z	edœd
d„Z
edœdd„Zedœdd„Zedœdd„Zedœdd„Zeed dœdd„ƒZdS )ÚClientWindowInfoz'Represents a client window information.©Úclient_windowÚstateÚwidthÚheightÚxÚyÚactivec                 C   s.   || _ || _|| _|| _|| _|| _|| _d S ©Nr   )Úselfr   r   r   r   r   r   r   r   r   r   Ú__init__$   s    
zClientWindowInfo.__init__©Úreturnc                 C   s   | j S )z©Gets the state of the client window.

        Returns:
        -------
            str: The state of the client window (one of the ClientWindowState constants).
        )r   ©r   r   r   r   Ú	get_state6   s    zClientWindowInfo.get_statec                 C   s   | j S )z|Gets the client window identifier.

        Returns:
        -------
            str: The client window identifier.
        )r   r   r   r   r   Úget_client_window?   s    z"ClientWindowInfo.get_client_windowc                 C   s   | j S )z€Gets the width of the client window.

        Returns:
        -------
            int: The width of the client window.
        )r   r   r   r   r   Ú	get_widthH   s    zClientWindowInfo.get_widthc                 C   s   | j S )z‚Gets the height of the client window.

        Returns:
        -------
            int: The height of the client window.
        )r   r   r   r   r   Ú
get_heightQ   s    zClientWindowInfo.get_heightc                 C   s   | j S )zŽGets the x coordinate of the client window.

        Returns:
        -------
            int: The x coordinate of the client window.
        )r   r   r   r   r   Úget_xZ   s    zClientWindowInfo.get_xc                 C   s   | j S )zŽGets the y coordinate of the client window.

        Returns:
        -------
            int: The y coordinate of the client window.
        )r   r   r   r   r   Úget_yc   s    zClientWindowInfo.get_yc                 C   s   | j S )z™Checks if the client window is active.

        Returns:
        -------
            bool: True if the client window is active, False otherwise.
        )r   r   r   r   r   Ú	is_activel   s    zClientWindowInfo.is_active)Údatar   c              
   C   s@   | |  d¡|  d¡|  d¡|  d¡|  d¡|  d¡|  d¡d�S )	a  Creates a ClientWindowInfo instance from a dictionary.

        Parameters:
        -----------
            data: A dictionary containing the client window information.

        Returns:
        -------
            ClientWindowInfo: A new instance of ClientWindowInfo.
        ZclientWindowr   r   r   r   r   r   r   )Úget)Úclsr#   r   r   r   Ú	from_dictu   s    ùzClientWindowInfo.from_dictN)r   r   r	   r
   ÚstrÚintÚboolr   r   r   r   r   r    r!   r"   Úclassmethodr   r&   r   r   r   r   r   !   s$   ø							r   c                   @   sZ   e Zd ZdZdd„ Zedœdd„Zee dœdd„Zed	d
œdd„Z	ee
 dœdd„Zd	S )ÚBrowserz4
    BiDi implementation of the browser module.
    c                 C   s
   || _ d S r   )Úconn)r   r,   r   r   r   r   ‘   s    zBrowser.__init__r   c                 C   s   | j  tdi ƒ¡}|d S )z{Creates a new user context.

        Returns:
        -------
            str: The ID of the created user context.
        zbrowser.createUserContextÚuserContext©r,   Úexecuter   ©r   Úresultr   r   r   Úcreate_user_context”   s    zBrowser.create_user_contextc                 C   s$   | j  tdi ƒ¡}dd„ |d D ƒS )zuGets all user contexts.

        Returns:
        -------
            List[str]: A list of user context IDs.
        zbrowser.getUserContextsc                 S   s   g | ]}|d  ‘qS )r-   r   )Ú.0Zcontext_infor   r   r   Ú
<listcomp>¦   ó    z-Browser.get_user_contexts.<locals>.<listcomp>ZuserContextsr.   r0   r   r   r   Úget_user_contextsž   s    zBrowser.get_user_contextsN)Úuser_context_idr   c                 C   s.   |dkrt dƒ‚d|i}| j td|ƒ¡ dS )zúRemoves a user context.

        Parameters:
        -----------
            user_context_id: The ID of the user context to remove.

        Raises:
        ------
            Exception: If the user context ID is "default" or does not exist.
        Údefaultz&Cannot remove the default user contextr-   zbrowser.removeUserContextN)Ú	Exceptionr,   r/   r   )r   r7   Úparamsr   r   r   Úremove_user_context¨   s    zBrowser.remove_user_contextc                 C   s$   | j  tdi ƒ¡}dd„ |d D ƒS )zŒGets all client windows.

        Returns:
        -------
            List[ClientWindowInfo]: A list of client window information.
        zbrowser.getClientWindowsc                 S   s   g | ]}t  |¡‘qS r   )r   r&   )r3   Zwindowr   r   r   r4   Á   r5   z.Browser.get_client_windows.<locals>.<listcomp>ZclientWindowsr.   r0   r   r   r   Úget_client_windows¹   s    zBrowser.get_client_windows)r   r   r	   r
   r   r'   r2   r   r6   r;   r   r<   r   r   r   r   r+   Œ   s   

r+   N)Útypingr   r   Z%selenium.webdriver.common.bidi.commonr   r   r   r+   r   r   r   r   Ú<module>   s
   	k