o
    US`c
  ã                   @   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                   @   s<   e Zd ZdZdd„ Zedd„ ƒZdd„ Zdd	„ Zd
d„ Z	dS )ÚAlertak  
    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)

    c                 C   s
   || _ dS )z}
        Creates a new Alert.

        :Args:
         - driver: The WebDriver instance which performs user actions.
        N)Údriver)Úselfr   © r   úJ/usr/local/lib/python3.10/dist-packages/selenium/webdriver/common/alert.pyÚ__init__4   s   
zAlert.__init__c                 C   s   | j  tj¡d S )z-
        Gets the text of the Alert.
        Úvalue)r   Úexecuter   ZW3C_GET_ALERT_TEXT©r   r   r   r   Útext=   s   z
Alert.textc                 C   ó   | j  tj¡ dS )z0
        Dismisses the alert available.
        N)r   r   r   ZW3C_DISMISS_ALERTr   r   r   r   ÚdismissD   s   zAlert.dismissc                 C   r   )zx
        Accepts the alert available.

        Usage::
        Alert(driver).accept() # Confirm a alert dialog.
        N)r   r   r   ZW3C_ACCEPT_ALERTr   r   r   r   ÚacceptJ   s   zAlert.acceptc                 C   s   | j  tjt|ƒ|dœ¡ dS )zn
        Send Keys to the Alert.

        :Args:
         - keysToSend: The text to be sent to Alert.
        )r
   r   N)r   r   r   ZW3C_SET_ALERT_VALUEr   )r   Z
keysToSendr   r   r   Ú	send_keysS   s   zAlert.send_keysN)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Úpropertyr   r   r   r   r   r   r   r   r      s    	
	r   N)r   Zselenium.webdriver.common.utilsr   Z!selenium.webdriver.remote.commandr   r   r   r   r   r   Ú<module>   s   