o
    ѷ6i                     @   s:   d dl mZ G dd dZG dd dZG dd dZdS )	    command_builderc                   @   s&   e Zd ZdZdZdZdZeeehZdS )UserPromptHandlerTypez3Represents the behavior of the user prompt handler.acceptdismissignoreN)__name__
__module____qualname____doc__ACCEPTDISMISSIGNOREVALID_TYPES r   r   k/var/www/hoanhtaovolam_webdjango/env/lib/python3.10/site-packages/selenium/webdriver/common/bidi/session.pyr      s    r   c                   @   sn   e Zd ZdZ						ddedB dedB dedB dedB dedB dedB fd	d
Zdeeef fddZdS )UserPromptHandlerz8Represents the configuration of the user prompt handler.Nalertbefore_unloadconfirmdefaultfilepromptc           	      C   s   d|fd|fd|fd|fd|fd|ffD ]\}}|dur/|t jvr/td| d	| d
t j q|| _|| _|| _|| _|| _|| _dS )a  Initialize UserPromptHandler.

        Args:
            alert: Handler type for alert prompts.
            before_unload: Handler type for beforeUnload prompts.
            confirm: Handler type for confirm prompts.
            default: Default handler type for all prompts.
            file: Handler type for file picker prompts.
            prompt: Handler type for prompt dialogs.

        Raises:
            ValueError: If any handler type is not valid.
        r   r   r   r   r   r   NzInvalid z handler type: z. Must be one of )	r   r   
ValueErrorr   r   r   r   r   r   )	selfr   r   r   r   r   r   
field_namevaluer   r   r   __init__#   s$   
zUserPromptHandler.__init__returnc                 C   sF   ddddddd}i }|  D ]\}}t| |}|dur |||< q|S )	zConvert the UserPromptHandler to a dictionary for BiDi protocol.

        Returns:
            Dictionary representation suitable for BiDi protocol.
        r   beforeUnloadr   r   r   r   )r   r   r   r   r   r   N)itemsgetattr)r   field_mappingresult	attr_namedict_keyr   r   r   r   to_dictM   s   	
zUserPromptHandler.to_dict)NNNNNN)r   r	   r
   r   strr   dictr&   r   r   r   r   r       s,    
*r   c                   @   s8   e Zd Zdd ZddddZddddZd	d
 ZdS )Sessionc                 C   s
   || _ d S )N)conn)r   r*   r   r   r   r   e   s   
zSession.__init__N)browsing_contextsc                G   *   d|i}|d u r
g }|r||d< t d|S )NeventsbrowsingContextszsession.subscriber   r   r+   r-   paramsr   r   r   	subscribeh      
zSession.subscribec                G   r,   )Nr-   r.   zsession.unsubscriber   r/   r   r   r   unsubscriber   r2   zSession.unsubscribec                 C   s   t di }| j|S )aP  The session.status command returns information about the remote end's readiness.

        Returns information about the remote end's readiness to create new sessions
        and may include implementation-specific metadata.

        Returns:
            Dictionary containing the ready state (bool), message (str) and metadata.
        zsession.status)r   r*   execute)r   cmdr   r   r   status|   s   
	zSession.status)r   r	   r
   r   r1   r3   r6   r   r   r   r   r)   d   s
    

r)   N)%selenium.webdriver.common.bidi.commonr   r   r   r)   r   r   r   r   <module>   s   
D