
    ,i".                         d dl Z d dlmZmZmZmZ d dlmZ d dlm	Z	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y)    N)NoReturnOptionalUnionoverload)WebDriverException)ByByType)
WebElementtag_namereturn
RelativeByc                 |    t        j                  d       | st        d      t        t        j
                  | i      S )a  Start searching for relative objects using a tag name.

    Args:
        tag_name: The DOM tag of element to start searching.

    Returns:
        RelativeBy: Use this object to create filters within a `find_elements` call.

    Raises:
        WebDriverException: If `tag_name` is None.

    Note:
        This method is deprecated and may be removed in future versions.
        Please use `locate_with` instead.
    zbThis method is deprecated and may be removed in future versions. Please use `locate_with` instead.ztag_name can not be null)warningswarnr   r   r   CSS_SELECTOR)r   s    z/var/www/system.tvplus.app.br/jogos/scrap/venv/lib/python3.12/site-packages/selenium/webdriver/support/relative_locator.pywith_tag_namer      s4      MMvw !;<<r122    byusingc                 @    | J d       |J d       t        | |i      S )a  Start searching for relative objects your search criteria with By.

    Args:
        by: The method to find the element.
        using: The value from `By` passed in.

    Returns:
        RelativeBy: Use this object to create filters within a `find_elements` call.

    Example:
        >>> lowest = driver.find_element(By.ID, "below")
        >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").above(lowest))
    zPlease pass in a by argumentzPlease pass in a using argument)r   )r   r   s     r   locate_withr   /   s5     >999>???r5k""r   c                   n   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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y)+r   a  Gives the opportunity to find elements based on their relative location
    on the page from a root element. 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                 (    || _         |xs g | _        y)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__R   s     	}"r   element_or_locatorr   c                      y N r   r    s     r   abovezRelativeBy.above^       Y\r   r   c                      y r"   r#   r$   s     r   r%   zRelativeBy.abovea       DGr   c                 ^    |st        d      | j                  j                  d|gd       | S )a  Add a filter to look for elements above.

        Args:
            element_or_locator: Element to look above

        Returns:
            RelativeBy

        Raises:
            WebDriverException: If `element_or_locator` is None.

        Example:
        --------
        >>> lowest = driver.find_element(By.ID, "below")
        >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").above(lowest))
        :Element or locator must be given when calling above methodr%   kindargsr   r   appendr$   s     r   r%   zRelativeBy.aboved   s3    " "$%abbW7I6JKLr   c                      y r"   r#   r$   s     r   belowzRelativeBy.below{   r&   r   c                      y r"   r#   r$   s     r   r1   zRelativeBy.below~   r(   r   c                 ^    |st        d      | j                  j                  d|gd       | S )a  Add a filter to look for elements below.

        Args:
            element_or_locator: Element to look below

        Returns:
            RelativeBy

        Raises:
            WebDriverException: If `element_or_locator` is None.

        Example:
            >>> highest = driver.find_element(By.ID, "high")
            >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").below(highest))
        :Element or locator must be given when calling below methodr1   r+   r.   r$   s     r   r1   zRelativeBy.below   s3      "$%abbW7I6JKLr   c                      y r"   r#   r$   s     r   
to_left_ofzRelativeBy.to_left_of   s    ^ar   c                      y r"   r#   r$   s     r   r6   zRelativeBy.to_left_of   s    ILr   c                 ^    |st        d      | j                  j                  d|gd       | S )a  Add a filter to look for elements to the left of.

        Args:
            element_or_locator: Element to look to the left of

        Returns:
            RelativeBy

        Raises:
            WebDriverException: If `element_or_locator` is None.

        Example:
            >>> right = driver.find_element(By.ID, "right")
            >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_left_of(right))
        ?Element or locator must be given when calling to_left_of methodleftr+   r.   r$   s     r   r6   zRelativeBy.to_left_of   s3      "$%fggV6H5IJKr   c                      y r"   r#   r$   s     r   to_right_ofzRelativeBy.to_right_of   s    _br   c                      y r"   r#   r$   s     r   r<   zRelativeBy.to_right_of   s    JMr   c                 ^    |st        d      | j                  j                  d|gd       | S )a  Add a filter to look for elements right of.

        Args:
            element_or_locator: Element to look right of

        Returns:
            RelativeBy

        Raises:
            WebDriverException: If `element_or_locator` is None.

        Example:
            >>> left = driver.find_element(By.ID, "left")
            >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").to_right_of(left))
        @Element or locator must be given when calling to_right_of methodrightr+   r.   r$   s     r   r<   zRelativeBy.to_right_of   s3      "$%ghhW7I6JKLr   c                      y r"   r#   r$   s     r   straight_abovezRelativeBy.straight_above       ber   c                      y r"   r#   r$   s     r   rB   zRelativeBy.straight_above       MPr   c                 ^    |st        d      | j                  j                  d|gd       | S )zvAdd a filter to look for elements above.

        Args:
            element_or_locator: Element to look above
        r*   straightAbover+   r.   r$   s     r   rB   zRelativeBy.straight_above   3     "$%abb_?Q>RSTr   c                      y r"   r#   r$   s     r   straight_belowzRelativeBy.straight_below   rC   r   c                      y r"   r#   r$   s     r   rJ   zRelativeBy.straight_below   rE   r   c                 ^    |st        d      | j                  j                  d|gd       | S )zvAdd a filter to look for elements below.

        Args:
            element_or_locator: Element to look below
        r4   straightBelowr+   r.   r$   s     r   rJ   zRelativeBy.straight_below   rH   r   c                      y r"   r#   r$   s     r   straight_left_ofzRelativeBy.straight_left_of   s    dgr   c                      y r"   r#   r$   s     r   rO   zRelativeBy.straight_left_of   s    ORr   c                 ^    |st        d      | j                  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
        r9   straightLeftr+   r.   r$   s     r   rO   zRelativeBy.straight_left_of   s3     "$%fgg^>P=QRSr   c                      y r"   r#   r$   s     r   straight_right_ofzRelativeBy.straight_right_of  s    ehr   c                      y r"   r#   r$   s     r   rT   zRelativeBy.straight_right_of  s    PSr   c                 ^    |st        d      | j                  j                  d|gd       | S )z|Add a filter to look for elements right of.

        Args:
            element_or_locator: Element to look right of
        r?   straightRightr+   r.   r$   s     r   rT   zRelativeBy.straight_right_of  s3     "$%ghh_?Q>RSTr   distancec                      y r"   r#   r   r    rX   s      r   nearzRelativeBy.near  s    lor   c                      y r"   r#   rZ   s      r   r[   zRelativeBy.near  s    WZr   c                     |st        d      |dk  rt        d      | j                  j                  d||gd       | S )a2  Add 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

        Returns:
            RelativeBy

        Raises:
            WebDriverException: If `element_or_locator` is None
            WebDriverException: If `distance` is less than or equal to 0.

        Example:
            >>> near = driver.find_element(By.ID, "near")
            >>> elements = driver.find_elements(locate_with(By.CSS_SELECTOR, "p").near(near, 50))
        z9Element or locator must be given when calling near methodr   zDistance must be positiver[   r+   r.   rZ   s      r   r[   zRelativeBy.near  sH    $ "$%`aaq=$%@AAV6H(5STUr   c                 8    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_dict7  s$     		<<
 	
r   )NNr"   )r    Nr   r   )2   )Nra   )__name__
__module____qualname____doc__dictr	   strLocatorTyper   listr   r   r   r
   r%   r1   r6   r<   rB   rJ   rO   rT   intr[   r`   r#   r   r   r   r   B   sP    vs{#K
%Xd63;&78 
%(SW. 
% \j+.E(F\<\ \G Gj+t.K(L Xd . \j+.E(F\<\ \G Gj$.D(E Q] , aU:{3J-KaP\a aL LU:tT3I-J Vb , beJ4K.LbQ]b bM MeJd4J.K Wc , ez;7N1OeT`e eP P
z;PT7T1U 
am 
 ez;7N1OeT`e eP P
z47M1N 
Zf 
 g5[9P3QgVbg gR R
5T49O3P 
\h 
 hE*k:Q4RhWch hS S
E*dD:P4Q 
]i 
 ouZ-D'EoQTo^jo oZtZcZ:Z ZuZd-J'K ^a kw 4
 
r   )r   typingr   r   r   r   selenium.common.exceptionsr   selenium.webdriver.common.byr   r	   $selenium.webdriver.remote.webelementr
   rg   r   r   r   r#   r   r   <module>ro      sR   "  6 6 9 3 ;3C 3L 3,#F #3 #< #&}
 }
r   