zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
U
\±d*ã@sˆddlmZddlmZddlmZddlmZddlmZddlmZddl    m
Z
e dd    œd
d „Z ee dd œd d„Z Gdd„dƒZdS)é)ÚDict)ÚList)ÚOptional)ÚUnion)ÚWebDriverException)ÚBy)Ú
WebElementÚ
RelativeBy)Útag_nameÚreturncCs|s tdƒ‚td|iƒS)aWStart 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.
    ztag_name can not be nullz css selector)rr    )r
©r úbd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/support/relative_locator.pyÚ with_tag_names r)ÚbyÚusingr cCs,|dk    stdƒ‚|dk    s tdƒ‚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.
    NzPlease pass in a by argumentzPlease pass in a using argument)ÚAssertionErrorr    )rrr r r Ú locate_with+s
rc@sÌeZdZdZdeeeeefefee    dœdd„Z
dee efddœdd„Z dee efddœd    d
„Z dee efddœd d „Zdee efddœd d„Zdee eefddœdd„Zedœdd„ZdS)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ÚfilterscCs||_|p g|_dS)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
        Nr)Úselfrrr r r Ú__init__Is    zRelativeBy.__init__)Úelement_or_locatorr cCs$|s tdƒ‚|j d|gdœ¡|S)z
        Add 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 methodÚabove©ÚkindÚargs©rrÚappend©rrr r r rUszRelativeBy.abovecCs$|s tdƒ‚|j d|gdœ¡|S)z
        Add 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 methodÚbelowrrrr r r r aszRelativeBy.belowcCs$|s tdƒ‚|j d|gdœ¡|S)z“
        Add 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Úleftrrrr r r Ú
to_left_ofmszRelativeBy.to_left_ofcCs$|s tdƒ‚|j d|gdœ¡|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Úrightrrrr r r Ú to_right_ofyszRelativeBy.to_right_of)Úelement_or_locator_distancer cCs$|s tdƒ‚|j d|gdœ¡|S)z¬
        Add a filter to look for elements near.
        :Args:
            - element_or_locator_distance: Element to look near by the element or within a distance
        zEElement or locator or distance must be given when calling near methodÚnearrr)rr%r r r r&…szRelativeBy.near)r cCsd|j|jdœiS)z[Create a dict that will be passed to the driver to start searching
        for the element.Úrelativerr)rr r r Úto_dict‘s
þÿzRelativeBy.to_dict)NN)N)N)N)N)N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrrÚstrrrrrr r"r$Úintr&r(r r r r r    :s*      N)ÚtypingrrrrZselenium.common.exceptionsrZselenium.webdriver.common.byrZ$selenium.webdriver.remote.webelementrr-rrr    r r r r Ú<module>s