
    (phr                         S SK r S SKrS SKJr  S SKJrJr  S SKJr  S SK	J
r
  S SKJr   " S S\" \5      5      r\" S	5       " S
 S\\S95       rg)    N)contextmanager)LiveServerTestCasetag)classpropertyimport_string)capfirstc                   x   ^  \ rS rSr/ rSrSrSrSrU 4S jr	\
S 5       r\
S 5       r\
S 5       rS rS	 rS
rU =r$ )SeleniumTestCaseBase   NFc                   > [         T
U ]  XX#5      nUR                  (       d%  [        S UR	                  5        5       5      (       d  U$ UR
                  (       a  UR
                  S   nXTl        UR                  (       d  UR                  OSnXdl        U R                  Ul        [        R                  UR                     nUR
                  SS  HV  nU R                  U [        U5      < U< 3U4UUU R                  UR                  S.5      n	[        XyR                  U	5        MX     U$ [        R                   " S5      " U5      $ )z
Dynamically create new classes and add them to the test module when
multiple browsers specs are provided (e.g. --selenium=firefox,chrome).
c              3   l   #    U  H*  u  pUR                  S 5      =(       a    [        U5      v   M,     g7f)testN)
startswithcallable).0namevalues      G/var/www/html/venv/lib/python3.13/site-packages/django/test/selenium.py	<genexpr>/SeleniumTestCaseBase.__new__.<locals>.<genexpr>   s*      )
KXKDDOOF#77=s   24r   z0.0.0.0   N)browserhostexternal_host
__module__zNo browsers specified.)super__new__r   anyitemsbrowsersselenium_hubr   r   sysmodulesr   r	   setattr__name__unittestskip)clsr   basesattrs
test_classfirst_browserr   moduler   browser_test_class	__class__s             r   r   SeleniumTestCaseBase.__new__   s*   
 W_S=
S )
KP;;=)
 &
 &
   
 '//2M!.*4*A*A:??yD"O'*'8'8J$ [[!6!67F%..qr2%([[&w/6M#* $),):):&0&;&;		
&"  ; ;=OP 3 }}56zBB    c                     [        SU-  5      $ )Nz)selenium.webdriver.%s.webdriver.WebDriverr   r)   r   s     r   import_webdriver%SeleniumTestCaseBase.import_webdriverA   s    H7RSSr2   c                     [        SU-  5      $ )Nz%selenium.webdriver.%s.options.Optionsr   r4   s     r   import_options#SeleniumTestCaseBase.import_optionsE   s    DwNOOr2   c                 @    SSK Jn  [        X!R                  5       5      $ )Nr   )DesiredCapabilities).selenium.webdriver.common.desired_capabilitiesr;   getattrupper)r)   r   r;   s      r   get_capability#SeleniumTestCaseBase.get_capabilityI   s    V*MMO<<r2   c                     U R                  U R                  5      " 5       nU R                  (       a=  U R                  =S:X  a    UR                  S5        U$ S:X  a  UR                  S5        U$ U$ )Nchromez--headless=newfirefoxz	-headless)r8   r   headlessadd_argument)selfoptionss     r   create_options#SeleniumTestCaseBase.create_optionsO   s\    %%dll35==,,(()9:  ((5wr2   c                 H   U R                  5       nU R                  (       ac  SSKJn  U R	                  U R
                  5      R                  5        H  u  p4UR                  X45        M     UR                  U R                  US9$ U R                  U R
                  5      " US9$ )Nr   )	webdriver)command_executorrG   )rG   )
rH   r"   seleniumrK   r?   r   r    set_capabilityRemoter5   )rF   rG   rK   keyr   s        r   create_webdriver%SeleniumTestCaseBase.create_webdriverY   s    %%'*"11$,,?EEG
&&s2 H ##T5F5FPW#XX$$T\\27CCr2    )r&   r   __qualname____firstlineno__r!   r"   r   r   rD   r   classmethodr5   r8   r?   rH   rQ   __static_attributes____classcell__r0   s   @r   r   r      st    HLMGH(CT T T P P = =
	D 	Dr2   r   rM   c                   z   ^  \ rS rSrSrSr\S 5       r\S 5       r\	U 4S j5       r
\	S 5       r\S 5       rS	rU =r$ )
SeleniumTestCasee   
   Nc                 x    SU R                   =(       d    U R                  < SU R                  R                  < 3$ )Nzhttp://:)r   r   server_threadportr)   s    r   live_server_url SeleniumTestCase.live_server_urlj   s+    !$!2!2!>chh!>@Q@Q@V@VWWr2   c                 @    U R                   =(       d    U R                  $ N)r   r   rb   s    r   allowed_hostSeleniumTestCase.allowed_hostn   s      ,CHH,r2   c                    > U R                  5       U l        U R                  R                  U R                  5        [        TU ]  5         U R                  U R                  5        g rf   )rQ   rM   implicitly_waitimplicit_waitr   
setUpClassaddClassCleanup_quit_selenium)r)   r0   s    r   rl   SeleniumTestCase.setUpClassr   sJ    ++-$$S%6%67C../r2   c                 \    [        U S5      (       a  U R                  R                  5         g g )NrM   )hasattrrM   quitrb   s    r   rn   SeleniumTestCase._quit_seleniumy   s&    
 3
##LL $r2   c              #      #    U R                   R                  S5         Sv   U R                   R                  U R                  5        g! U R                   R                  U R                  5        f = f7f)z"Disable the default implicit wait.r   N)rM   rj   rk   )rF   s    r   disable_implicit_wait&SeleniumTestCase.disable_implicit_wait   sQ      	%%a(	>MM))$*<*<=DMM))$*<*<=s   A3A	 &A3	'A00A3rS   )r&   r   rT   rU   rk   r   r   rc   rg   rV   rl   rn   r   ru   rW   rX   rY   s   @r   r[   r[   e   sq    MMX X - - 0 0     > >r2   r[   )	metaclass)r#   r'   
contextlibr   django.testr   r   django.utils.functionalr   django.utils.module_loadingr   django.utils.textr	   typer   r[   rS   r2   r   <module>r~      sT    
  % / 1 5 &WD4 23 WDt Z">)5I "> ">r2   