
     f*                         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 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 deddfdZdededdfdZ G d d          ZdS )    )Dict)List)NoReturn)Optional)Union)overload)WebDriverException)By)ByType)
WebElementtag_namereturn
RelativeByc                 Z    | st          d          t          t          j        | i          S )aW  Start searching for relative objects using a tag name.

    Note: This method may be removed in future versions, please use
    `locate_with` instead.
    :Args:
        - tag_name: the DOM tag of element to start searching.
    :Returns:
        - RelativeBy - use this object to create filters within a
            `find_elements` call.
    ztag_name can not be null)r	   r   r
   CSS_SELECTOR)r   s    n/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/support/relative_locator.pywith_tag_namer      s0      = !;<<<r1222    byusingc                 T    | 
J d            |
J d            t          | |i          S )a)  Start searching for relative objects your search criteria with By.

    :Args:
        - by: The value from `By` passed in.
        - using: search term to find the element with.
    :Returns:
        - RelativeBy - use this object to create filters within a
            `find_elements` call.
    NzPlease pass in a by argumentzPlease pass in a using argument)r   )r   r   s     r   locate_withr   .   s;     >>9>>>?r5k"""r   c                      e Zd ZdZeeef         Zddeeeef                  dee	         fdZ
edeeef         dd fd            Zeddd
            Zddeeedf         dd fdZedeeef         dd fd            Zeddd            Zddeeedf         dd fdZedeeef         dd fd            Zeddd            Zddeeedf         dd fdZedeeef         dd fd            Zeddd            Zddeeedf         dd fdZeddeeef         dedd fd            Zeddddedd	fd            Zddeeedf         dedd fdZdefdZdS ) r   a  Gives the opportunity to find elements based on their relative location
    on the page from a root elelemt. It is recommended that you use the helper
    function to create it.

    Example:
        lowest = driver.find_element(By.ID, "below")

        elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").above(lowest))

        ids = [el.get_attribute('id') for el in elements]
        assert "above" in ids
        assert "mid" in ids
    Nrootfiltersc                 &    || _         |pg | _        dS )a  Creates a new RelativeBy object. It is preferred if you use the
        `locate_with` method as this signature could change.

        :Args:
            root - A dict with `By` enum as the key and the search query as the value
            filters - A list of the filters that will be searched. If none are passed
                in please use the fluent API on the object to create the filters
        Nr   r   )selfr   r   s      r   __init__zRelativeBy.__init__N   s     	}"r   element_or_locatorr   c                     d S N r   r    s     r   abovezRelativeBy.aboveZ       Y\Y\r   r   c                     d S r"   r#   r$   s     r   r%   zRelativeBy.above]       DGCr   c                 d    |st          d          | j                            d|gd           | S )zyAdd a filter to look for elements above.

        :Args:
            - element_or_locator: Element to look above
        z:Element or locator must be given when calling above methodr%   kindargsr	   r   appendr$   s     r   r%   zRelativeBy.above`   C     " 	c$%abbbW7I6JKKLLLr   c                     d S r"   r#   r$   s     r   belowzRelativeBy.belowl   r&   r   c                     d S r"   r#   r$   s     r   r1   zRelativeBy.belowo   r(   r   c                 d    |st          d          | j                            d|gd           | S )zyAdd a filter to look for elements below.

        :Args:
            - element_or_locator: Element to look below
        z:Element or locator must be given when calling below methodr1   r*   r-   r$   s     r   r1   zRelativeBy.belowr   r/   r   c                     d S r"   r#   r$   s     r   
to_left_ofzRelativeBy.to_left_of~   s    ^a^ar   c                     d S r"   r#   r$   s     r   r5   zRelativeBy.to_left_of   s    ILr   c                 d    |st          d          | j                            d|gd           | S )zAdd a filter to look for elements to the left of.

        :Args:
            - element_or_locator: Element to look to the left of
        z?Element or locator must be given when calling to_left_of methodleftr*   r-   r$   s     r   r5   zRelativeBy.to_left_of   sC     " 	h$%fgggV6H5IJJKKKr   c                     d S r"   r#   r$   s     r   to_right_ofzRelativeBy.to_right_of   s    _b_br   c                     d S r"   r#   r$   s     r   r:   zRelativeBy.to_right_of   s    JM#r   c                 d    |st          d          | j                            d|gd           | S )zAdd a filter to look for elements right of.

        :Args:
            - element_or_locator: Element to look right of
        z@Element or locator must be given when calling to_right_of methodrightr*   r-   r$   s     r   r:   zRelativeBy.to_right_of   sC     " 	i$%ghhhW7I6JKKLLLr   2   distancec                     d S r"   r#   r   r    r?   s      r   nearzRelativeBy.near   s    lolor   c                     d S r"   r#   rA   s      r   rB   zRelativeBy.near   s    WZWZr   c                     |st          d          |dk    rt          d          | j                            d||gd           | S )zAdd a filter to look for elements near.

        :Args:
            - element_or_locator: Element to look near by the element or within a distance
            - distance: distance in pixel
        z9Element or locator must be given when calling near methodr   zDistance must be positiverB   r*   r-   rA   s      r   rB   zRelativeBy.near   s]     " 	b$%`aaaq==$%@AAAV6H(5STTUUUr   c                 $    d| j         | j        diS )z[Create a dict that will be passed to the driver to start searching
        for the element.relativer   r   )r   s    r   to_dictzRelativeBy.to_dict   s%     	< 
 	
r   )NNr"   )r    Nr   r   )r>   )Nr>   )__name__
__module____qualname____doc__r   r   strLocatorTyper   r   r   r   r   r   r%   r1   r5   r:   intrB   rG   r#   r   r   r   r   =   s         vs{#K
% 
%Xd63;&78 
%(SW. 
% 
% 
% 
% \j+.E(F\<\\\ X\GGGG XG
 
j+t.K(L 
Xd 
 
 
 
 \j+.E(F\<\\\ X\GGGG XG
 
j$.D(E 
Q] 
 
 
 
 aU:{3J-KaP\aaa XaLLLL XL
 
U:tT3I-J 
Vb 
 
 
 
 beJ4K.LbQ]bbb XbMMMM XM
 
eJd4J.K 
Wc 
 
 
 
 oouZ-D'EoQTo^jooo XoZZtZcZ:ZZZ XZ uZd-J'K ^a kw    
 
 
 
 
 
 
r   N)typingr   r   r   r   r   r   selenium.common.exceptionsr	   selenium.webdriver.common.byr
   r   $selenium.webdriver.remote.webelementr   rL   r   r   r   r#   r   r   <module>rS      sB  "                                     9 9 9 9 9 9 + + + + + + / / / / / / ; ; ; ; ; ;3C 3L 3 3 3 3 #F #3 #< # # # #B
 B
 B
 B
 B
 B
 B
 B
 B
 B
r   