zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
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
72
73
74
75
76
77
78
79
80
U
\±d—ã@sfddlmZddlmZddlmZddlmZddlmZddlm    Z    ddl
m Z Gd    d
„d
ƒZ d S) é)ÚNoSuchElementException)ÚNoSuchFrameException)ÚNoSuchWindowException)ÚAlert)ÚBy)Ú
WebElementé)ÚCommandc@sˆeZdZdd„Zeedœdd„ƒZeedœdd„ƒZddœd    d
„Z    ddœd d „Z
dddœd d„Z ddœdd„Z ddœdd„Z dd„ZdS)ÚSwitchTocCsddl}| |¡|_dS)Nr)ÚweakrefÚproxyÚ_driver)ÚselfZdriverr ©rúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\selenium/webdriver/remote/switch_to.pyÚ__init__szSwitchTo.__init__)ÚreturncCs|j tj¡dS)z¡Returns the element with focus, or BODY if nothing has focus.
 
        :Usage:
            ::
 
                element = driver.switch_to.active_element
        Úvalue)r Úexecuter    ZW3C_GET_ACTIVE_ELEMENT©rrrrÚactive_element"s    zSwitchTo.active_elementcCst|jƒ}|j}|S)z€Switches focus to an alert on the page.
 
        :Usage:
            ::
 
                alert = driver.switch_to.alert
        )rr Útext)rÚalertÚ_rrrr-s    
zSwitchTo.alertNcCs|j tjddi¡dS)zSwitch focus to the default frame.
 
        :Usage:
            ::
 
                driver.switch_to.default_content()
        ÚidN)r rr    ÚSWITCH_TO_FRAMErrrrÚdefault_content:szSwitchTo.default_contentc Cs~t|tƒrfz|j tj|¡}WnFtk
rdz|j tj|¡}Wntk
r^t|ƒ‚YnXYnX|j     t
j d|i¡dS)aïSwitches focus to the specified frame, by index, name, or
        webelement.
 
        :Args:
         - frame_reference: The name of the window to switch to, an integer representing the index,
                            or a webelement that is an (i)frame to switch to.
 
        :Usage:
            ::
 
                driver.switch_to.frame('frame_name')
                driver.switch_to.frame(1)
                driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
        rN) Ú
isinstanceÚstrr Z find_elementrZIDrÚNAMErrr    r)rZframe_referencerrrÚframeDs
zSwitchTo.framecCs*|j tjd|i¡d}| |d¡dS)aSwitches to a new top-level browsing context.
 
        The type hint can be one of "tab" or "window". If not specified the
        browser will automatically select it.
 
        :Usage:
            ::
 
                driver.switch_to.new_window('tab')
        ÚtyperÚhandleN)r rr    Z
NEW_WINDOWÚ _w3c_window)rZ    type_hintrrrrÚ
new_window^s zSwitchTo.new_windowcCs|j tj¡dS)zàSwitches focus to the parent context. If the current context is the
        top level browsing context, the context remains unchanged.
 
        :Usage:
            ::
 
                driver.switch_to.parent_frame()
        N)r rr    ZSWITCH_TO_PARENT_FRAMErrrrÚ parent_framels    zSwitchTo.parent_framecCs| |¡dS)zßSwitches focus to the specified window.
 
        :Args:
         - window_name: The name or window handle of the window to switch to.
 
        :Usage:
            ::
 
                driver.switch_to.window('main')
        N)r#)rÚ window_namerrrÚwindowws zSwitchTo.windowcsz‡fdd„}z ||ƒWn\tk
rtˆjj}ˆjj}|D](}||ƒˆj d¡}||kr<YdSq<||ƒ‚YnXdS)Ncsˆj tjd|i¡dS)Nr")r rr    ZSWITCH_TO_WINDOW)ÚhrrrÚ send_handle…sz)SwitchTo._w3c_window.<locals>.send_handlezreturn window.name)rr Zcurrent_window_handleZwindow_handlesZexecute_script)rr&r)Zoriginal_handleZhandlesr"Z current_namerrrr#„s   
zSwitchTo._w3c_window)N)Ú__name__Ú
__module__Ú __qualname__rÚpropertyrrrrrr r$r%r'r#rrrrr
s
 
  r
N) Zselenium.common.exceptionsrrrZselenium.webdriver.common.alertrZselenium.webdriver.common.byrZ$selenium.webdriver.remote.webelementrÚcommandr    r
rrrrÚ<module>s