
    ^jV                     v    d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z d dlmZ d dlmZ ddlmZ
  G d d	e      Zy
)    )TYPE_CHECKINGCallableDictListOptionalUnion)keys_to_typing)Command)
WebElement)Self   )MobileCommandc                       e Zd ZU eed<   eed<   er%ddedeeedf   de	fdZ
ddedeeedf   dee	   fdZd	edeeeef      fd
ZdefdZde	fdZedeeef   fd       Zdede	fdZy)r   _execute_idNbyvaluereturnc                      y N selfr   r   s      O/home/ubuntu/.local/lib/python3.12/site-packages/appium/webdriver/webelement.pyfind_elementzWebElement.find_element           c                      y r   r   r   s      r   find_elementszWebElement.find_elements"   r   r   namec                    | j                  t        j                  d|i      }|j                  d      }|yt	        |t
              r|S t	        |t              st        |      }|dk7  r"|j                         dv r|j                         S |S )a  Gets the given attribute or property of the element.

        Override for Appium

        This method will first try to return the value of a property with the
        given name. If a property with that name doesn't exist, it returns the
        value of the attribute with the same name. If there's no attribute with
        that name, ``None`` is returned.

        Values which are considered truthy, that is equals "true" or "false",
        are returned as booleans.  All other non-``None`` values are returned
        as strings.  For attributes or properties which do not exist, ``None``
        is returned.

        Args:
            name: Name of the attribute/property to retrieve.

        Usage:
            # Check if the "active" CSS class is applied to an element.

            is_active = "active" in target_element.get_attribute("class")

        Returns:
            The given attribute or property of the element
        r    r   N)truefalse)r   RemoteCommandGET_ELEMENT_ATTRIBUTEget
isinstancedictstrlower)r   r    respattribute_values       r   get_attributezWebElement.get_attribute%   s    6 }}]@@64.Q((7+"ot,"" /3/!/2O7?446:KK"((**r   c                 F    | j                  t        j                        d   S )zOWhether the element is visible to a user.

        Override for Appium
        r   )r   r
   IS_ELEMENT_DISPLAYEDr   s    r   is_displayedzWebElement.is_displayedR   s    
 }}W99:7CCr   c                 b    d| j                   i}| j                  t        j                  |       | S )zyClears text.

        Override for Appium

        Returns:
            `appium.webdriver.webelement.WebElement`
        id)r3   r   r
   CLEAR)r   datas     r   clearzWebElement.clearY   s(     dgggmmT*r   c                 F    | j                  t        j                        d   S )a  Gets the location of an element relative to the view.

        Usage:
            | location = element.location_in_view
            | x = location['x']
            | y = location['y']

        Returns:
            dict: The location of an element relative to the view
        r   )r   r
   LOCATION_IN_VIEWr0   s    r   location_in_viewzWebElement.location_in_viewh   s     }}W556w??r   c                     t        |      }| j                  t        j                  dj	                  |      |d       | S )zSimulates typing into the element.

        Args:
            value: A string for typing.

        Returns:
            `appium.webdriver.webelement.WebElement`
         )textr   )r	   r   r$   SEND_KEYS_TO_ELEMENTjoin)r   r   keyss      r   	send_keyszWebElement.send_keysw   s5     e$m882774=[_:`ar   r   )__name__
__module____qualname__r   __annotations__r)   r   r   r   r   r   r   r   r   r-   boolr1   r6   propertyintr9   r@   r   r   r   r   r      s    	H	3 	uS$_/E 	QU 		C 	c4o0F 	RVW[R\ 	+# +(5d3C*D +ZDd Dt  @$sCx. @ @  r   r   N)typingr   r   r   r   r   r   selenium.webdriver.common.utilsr	   !selenium.webdriver.remote.commandr
   r$   $selenium.webdriver.remote.webelementr   SeleniumWebElementtyping_extensionsr   mobilecommandr   r   r   r   <module>rO      s,    H G : F Q " 3i# ir   