o
    ©Rh
  ã                   @   s.   d Z ddlmZ ddlmZ G dd„ dƒZdS )zThe Alert implementation.é    )Úkeys_to_typing)ÚCommandc                   @   sR   e Zd ZdZddd„Zedefdd„ƒZddd	„Zdd
d„Z	deddfdd„Z
dS )ÚAlertag  Allows to work with alerts.

    Use this class to interact with alert prompts.  It contains methods for dismissing,
    accepting, inputting, and getting text from alert prompts.

    Accepting / Dismissing alert prompts::

        Alert(driver).accept()
        Alert(driver).dismiss()

    Inputting a value into an alert prompt::

        name_prompt = Alert(driver)
        name_prompt.send_keys("Willian Shakesphere")
        name_prompt.accept()


    Reading a the text of a prompt for verification::

        alert_text = Alert(driver).text
        self.assertEqual("Do you wish to quit?", alert_text)
    ÚreturnNc                 C   s
   || _ dS )ztCreates a new Alert.

        :Args:
         - driver: The WebDriver instance which performs user actions.
        N)Údriver)Úselfr   © r   úa/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/selenium/webdriver/common/alert.pyÚ__init__/   s   
zAlert.__init__c                 C   s   | j  tj¡d S )zGets the text of the Alert.Úvalue)r   Úexecuter   ÚW3C_GET_ALERT_TEXT©r   r   r   r	   Útext7   s   z
Alert.textc                 C   ó   | j  tj¡ dS )zDismisses the alert available.N)r   r   r   ÚW3C_DISMISS_ALERTr   r   r   r	   Údismiss<   s   zAlert.dismissc                 C   r   )zˆAccepts the alert available.

        :Usage:
            ::

                Alert(driver).accept()  # Confirm a alert dialog.
        N)r   r   r   ÚW3C_ACCEPT_ALERTr   r   r   r	   Úaccept@   s   zAlert.acceptÚ
keysToSendc                 C   s   | j  tjt|ƒ|dœ¡ dS )zeSend Keys to the Alert.

        :Args:
         - keysToSend: The text to be sent to Alert.
        )r   r   N)r   r   r   ÚW3C_SET_ALERT_VALUEr   )r   r   r   r   r	   Ú	send_keysJ   s   zAlert.send_keys)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   ÚpropertyÚstrr   r   r   r   r   r   r   r	   r      s    



r   N)r   Úselenium.webdriver.common.utilsr   Ú!selenium.webdriver.remote.commandr   r   r   r   r   r	   Ú<module>   s   