a
    >xd                     @   s0   d Z ddlmZ ddlmZ G dd deZdS )zDialog module.    )SimpleNamespace)
CDPSessionc                   @   s   e Zd ZdZedddddZdeeeedd	d
dZe	edddZ
e	edddZe	edddZdeddddZddddZdS )Dialoga  Dialog class.

    Dialog objects are dispatched by page via the ``dialog`` event.

    An example of using ``Dialog`` class:

    .. code::

        browser = await launch()
        page = await browser.newPage()

        async def close_dialog(dialog):
            print(dialog.message)
            await dialog.dismiss()
            await browser.close()

        page.on(
            'dialog',
            lambda dialog: asyncio.ensure_future(close_dialog(dialog))
        )
        await page.evaluate('() => alert("1")')
    alertZbeforeunloadZconfirmprompt)ZAlertZBeforeUnloadZConfirmPrompt N)clienttypemessagedefaultValuereturnc                 C   s"   || _ || _|| _d| _|| _d S )NF)_client_type_message_handled_defaultValue)selfr	   r
   r   r    r   H/var/www/html/Ranjet/env/lib/python3.9/site-packages/pyppeteer/dialog.py__init__*   s
    zDialog.__init__)r   c                 C   s   | j S )zbGet dialog type.

        One of ``alert``, ``beforeunload``, ``confirm``, or ``prompt``.
        )r   r   r   r   r   r
   2   s    zDialog.typec                 C   s   | j S )zGet dialog message.)r   r   r   r   r   r   :   s    zDialog.messagec                 C   s   | j S )zwIf dialog is prompt, get default prompt value.

        If dialog is not prompt, return empty string (``''``).
        )r   r   r   r   r   r   ?   s    zDialog.defaultValue)
promptTextr   c                    s$   d| _ | jdd|dI dH  dS )zAccept the dialog.

        * ``promptText`` (str): A text to enter in prompt. If the dialog's type
          is not prompt, this does not cause any effect.
        TPage.handleJavaScriptDialog)acceptr   Nr   r   send)r   r   r   r   r   r   G   s
    zDialog.acceptc                    s"   d| _ | jdddiI dH  dS )zDismiss the dialog.Tr   r   FNr   r   r   r   r   dismissS   s    zDialog.dismiss)r   )r   )__name__
__module____qualname____doc__r   Typer   strr   propertyr
   r   r   r   r   r   r   r   r   r      s&    r   N)r!   typesr   Zpyppeteer.connectionr   objectr   r   r   r   r   <module>   s   