Ë
    cQbj¿  ã                  óx   — d dl mZ d dlmZ d dlmZmZmZ d dlm	Z	 d dl
mZ d dlmZ erd dlmZ  G d„ d	«      Zy
)é    )Úannotations)ÚTYPE_CHECKING)ÚNoSuchElementExceptionÚNoSuchFrameExceptionÚNoSuchWindowException)ÚBy)ÚCommand)Ú
WebElement©ÚAlertc                  ój   — e Zd Zdd„Zedd„«       Zedd„«       Zdd„Zdd„Zddd„Z	dd„Z
dd	„Zdd
„Zy)ÚSwitchToc                ó8   — dd l }|j                  |«      | _        y )Nr   )ÚweakrefÚproxyÚ_driver)ÚselfÚdriverr   s      úV/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/remote/switch_to.pyÚ__init__zSwitchTo.__init__!   s   € Ûà—}‘} VÓ,ˆ�ó    c                óZ   — | j                   j                  t        j                  «      d   S )zŽReturns 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_elementzSwitchTo.active_element&   s$   € ð �|‰|×#Ñ#¤G×$BÑ$BÓCÀGÑLÐLr   c                óN   — ddl m}  || j                  «      }|j                  }|S )zmSwitches focus to an alert on the page.

        Example:
            alert = driver.switch_to.alert
        r   r   )Úselenium.webdriver.common.alertr   r   Útext)r   r   ÚalertÚ_s       r   r!   zSwitchTo.alert/   s#   € õ 	:á�d—l‘lÓ#ˆØ�J‰JˆØˆr   c                ó\   — | j                   j                  t        j                  ddi«       y)zlSwitch focus to the default frame.

        Example:
            driver.switch_to.default_content()
        ÚidN)r   r   r	   ÚSWITCH_TO_FRAMEr   s    r   Údefault_contentzSwitchTo.default_content<   s"   € ð 	�‰×ÑœW×4Ñ4°t¸T°lÕCr   c                ó‚  — t        |t        «      r+	 | j                  j                  t        j
                  |«      }| j                  j                  t        j                  d|i«       y# t        $ rL 	 | j                  j                  t        j                  |«      }n# t        $ r}t        |«      |‚d}~ww xY wY Œ�w xY w)aÅ  Switch focus to the specified frame by index, name, or element.

        Args:
            frame_reference: The name of the frame 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   Úframe_referenceÚexcs      r   ÚframezSwitchTo.frameD   s¦   € ô �o¤sÔ+ðIØ"&§,¡,×";Ñ";¼B¿E¹EÀ?Ó"S�ð 	�‰×ÑœW×4Ñ4°t¸_Ð6MÕNøô *ò IðIØ&*§l¡l×&?Ñ&?ÄÇÁÈÓ&Y‘OøÜ-ò IÜ.¨Ó?ÀSÐHûðIúñ $ðIús5   ’*A) Á)	B>Á3*BÂB>Â	B8Â'B3Â3B8Â8B>Â=B>Nc                óŠ   — | j                   j                  t        j                  d|i«      d   }| j	                  |d   «       y)zöSwitches 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   Ú	type_hintr   s      r   Ú
new_windowzSwitchTo.new_window[   s<   € ð —‘×$Ñ$¤W×%7Ñ%7¸&À)Ð9LÓMÈgÑVˆØ×Ñ˜˜x™Õ)r   c                óV   — | j                   j                  t        j                  «       y)zØSwitch focus to the parent browsing context.

        If the current context is already the top level browsing context, it remains unchanged.

        Example:
                driver.switch_to.parent_frame()
        N)r   r   r	   ÚSWITCH_TO_PARENT_FRAMEr   s    r   Úparent_framezSwitchTo.parent_frameg   s   € ð 	�‰×ÑœW×;Ñ;Õ<r   c                ó&   — | j                  |«       y)zÌSwitches 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)r4   )r   Úwindow_names     r   ÚwindowzSwitchTo.windowq   s   € ð 	×Ñ˜Õ%r   c                ó
  ‡ — ˆ fd„}	  ||«       y # t         $ rh ‰ j                  j                  }‰ j                  j                  }|D ]-  } ||«       ‰ j                  j	                  d«      }||k(  sŒ, Y y   ||«       ‚ w xY w)Nc                ó^   •— ‰j                   j                  t        j                  d| i«       y )Nr2   )r   r   r	   ÚSWITCH_TO_WINDOW)Úhr   s    €r   Úsend_handlez)SwitchTo._w3c_window.<locals>.send_handle}   s!   ø€ Ø�L‰L× Ñ ¤×!9Ñ!9¸HÀa¸=ÕIr   zreturn window.name)r   r   Úcurrent_window_handleÚwindow_handlesÚexecute_script)r   r;   rA   Úoriginal_handleÚhandlesr2   Úcurrent_names   `      r   r4   zSwitchTo._w3c_window|   s‡   ø€ ô	Jð	á˜Õ$øÜ$ò 
	à"Ÿl™l×@Ñ@ˆOØ—l‘l×1Ñ1ˆGØ!ò �Ù˜FÔ#Ø#Ÿ|™|×:Ñ:Ð;OÓP�Ø ,Ó.Úð	ñ
 ˜Ô(Øð
	ús   ˆ ‘A"BÁ4BÁ7B)ÚreturnÚNone)rH   r
   )rH   r   )r-   zstr | int | WebElementrH   rI   )N)r5   z
str | NonerH   rI   )r;   r)   rH   rI   )Ú__name__Ú
__module__Ú__qualname__r   Úpropertyr   r!   r&   r/   r6   r9   r<   r4   © r   r   r   r       sQ   „ ó-ð
 òMó ðMð ò
ó ð
óDóOô.
*ó=ó	&ôr   r   N)Ú
__future__r   Útypingr   Úselenium.common.exceptionsr   r   r   Úselenium.webdriver.common.byr   Ú!selenium.webdriver.remote.commandr	   Ú$selenium.webdriver.remote.webelementr
   r   r   r   rN   r   r   ú<module>rU      s.   ðõ& #å  ç jÑ jÝ +Ý 5Ý ;áÝ5÷mò mr   