a
    RIh8                     @   sJ   d dl mZ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   `/var/www/html/venv_bot_3.9/lib/python3.9/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 )zGets 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_state5   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 )zGets the width of the client window.

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

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

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

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

        Returns:
        -------
            bool: True if the client window is active, False otherwise.
        )r   r   r   r   r   	is_activek   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_dictt   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 )zRemoves 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 )zGets 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