
    iZ                     l    S SK JrJr  S SKJrJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJr   " S S5      rg	)
    )OptionalUnion)NoSuchElementExceptionNoSuchFrameExceptionNoSuchWindowException)Alert)By)Command)
WebElementc                       \ rS rSrSS jr\S\4S j5       r\S\4S j5       r	SS jr
S\\\\4   SS4S	 jrSS
\\   SS4S jjrSS jrS\SS4S jrS\SS4S jrSrg)SwitchTo   returnNc                 8    SS K nUR                  U5      U l        g )Nr   )weakrefproxy_driver)selfdriverr   s      PC:\des-py\RoboSAPF\venv\Lib\site-packages\selenium\webdriver\remote\switch_to.py__init__SwitchTo.__init__   s    }}V,    c                 Z    U R                   R                  [        R                  5      S   $ )zvReturns the element with focus, or BODY if nothing has focus.

Example:
    element = driver.switch_to.active_element
value)r   executer
   W3C_GET_ACTIVE_ELEMENTr   s    r   active_elementSwitchTo.active_element!   s$     ||##G$B$BCGLLr   c                 H    [        U R                  5      nUR                  nU$ )zUSwitches focus to an alert on the page.

Example:
    alert = driver.switch_to.alert
)r   r   text)r   alert_s      r   r#   SwitchTo.alert*   s      dll#JJr   c                 \    U R                   R                  [        R                  SS05        g)zTSwitch focus to the default frame.

Example:
    driver.switch_to.default_content()
idN)r   r   r
   SWITCH_TO_FRAMEr   s    r   default_contentSwitchTo.default_content5   s"     	W44tTlCr   frame_referencec                    [        U[        5      (       a+   U R                  R                  [        R
                  U5      nU R                  R                  [        R                  SU05        g! [         aL     U R                  R                  [        R                  U5      n Nd! [         a  n[        U5      UeSnAff = ff = f)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.

Example:
        driver.switch_to.frame("frame_name")
        driver.switch_to.frame(1)
        driver.switch_to.frame(driver.find_elements(By.TAG_NAME, "iframe")[0])
Nr'   )
isinstancestrr   find_elementr	   IDr   NAMEr   r   r
   r(   )r   r+   excs      r   frameSwitchTo.frame=   s     os++I"&,,";";BEE?"S 	W44t_6MN * II&*ll&?&?&YO- I.?SHIIs)   *A. .
C9*B%%
C /B;;C  C	type_hintc                     U R                   R                  [        R                  SU05      S   nU R	                  US   5        g)zSwitches 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.

Example:
        driver.switch_to.new_window("tab")
typer   handleN)r   r   r
   
NEW_WINDOW_w3c_window)r   r5   r   s      r   
new_windowSwitchTo.new_windowU   s<     $$W%7%7&)9LMgVx)r   c                 V    U R                   R                  [        R                  5        g)zSwitches focus to the parent context. If the current context is the
top level browsing context, the context remains unchanged.

Example:
        driver.switch_to.parent_frame()
N)r   r   r
   SWITCH_TO_PARENT_FRAMEr   s    r   parent_frameSwitchTo.parent_framea   s     	W;;<r   window_namec                 &    U R                  U5        g)zSwitches focus to the specified window.

Args:
    window_name: The name or window handle of the window to switch to.

Example:
    driver.switch_to.window("main")
N)r:   )r   rA   s     r   windowSwitchTo.windowj   s     	%r   c                   ^  U 4S jn U" U5        g ! [          aj    T R                  R                  nT R                  R                  nU H.  nU" U5        T R                  R	                  S5      nX:X  d  M-     g    U" U5        e f = f)Nc                 ^   > TR                   R                  [        R                  SU 05        g )Nr8   )r   r   r
   SWITCH_TO_WINDOW)hr   s    r   send_handle)SwitchTo._w3c_window.<locals>.send_handlev   s!    LL  !9!9Ha=Ir   zreturn window.name)r   r   current_window_handlewindow_handlesexecute_script)r   rA   rI   original_handlehandlesr8   current_names   `      r   r:   SwitchTo._w3c_windowu   s    	J	$$ 
	"ll@@Oll11G!F##||::;OP.	 "
 (
	s    A!B7B:B)r   )r   N)N)__name__
__module____qualname____firstlineno__r   propertyr   r   r   r#   r)   r   r.   intr3   r   r;   r?   rC   r:   __static_attributes__ r   r   r   r      s    -
 M
 M M u  DOU3Z+?%@ OT O0
*HSM 
*T 
*=	&# 	&$ 	&s t r   r   N)typingr   r   selenium.common.exceptionsr   r   r   selenium.webdriver.common.alertr   selenium.webdriver.common.byr	   !selenium.webdriver.remote.commandr
   $selenium.webdriver.remote.webelementr   r   rY   r   r   <module>r`      s(   $ # j j 1 + 5 ;k kr   