Ë
    `§1hÅ  ã                   óœ   — d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZ d dlmZ  ej                  e«      Z G d„ d«      Zy)é    N)ÚPath)ÚListÚOptional)ÚWebDriverExceptionc                   ór   — e Zd ZdZdedefd„Zedefd„«       Z	edee
   defd„«       Zedee   fd„«       Zy	)
ÚSeleniumManagerzƒWrapper for getting information from the Selenium Manager binaries.

    This implementation is still in beta, and may change.
    ÚargsÚreturnc                 óR  — t        | j                  «       «      g|z   }t        j                  «       t        j
                  k(  r|j                  d«       |j                  d«       |j                  d«       |j                  d«       |j                  d«       | j                  |«      S )zÆDetermines the locations of the requested assets.

        :Args:
         - args: the commands to send to the selenium manager binary.
        :Returns: dictionary of assets and their path
        z--debugz--language-bindingÚpythonz--outputÚjson)ÚstrÚ_get_binaryÚloggerÚgetEffectiveLevelÚloggingÚDEBUGÚappendÚ_run)Úselfr	   s     úh/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/selenium/webdriver/common/selenium_manager.pyÚbinary_pathszSeleniumManager.binary_paths&   s   € ô �D×$Ñ$Ó&Ó'Ð(¨4Ñ/ˆÜ×#Ñ#Ó%¬¯©Ò6Ø�K‰K˜	Ô"Ø�‰Ð(Ô)Ø�‰�HÔØ�‰�JÔØ�‰�FÔà�y‰y˜‹Ðó    c                  óP  — t        t        «      j                  j                  d«      } t	        j
                  d«      }|�| j                  |«      } d}t        j                  d«      x}�"t        j                  d|«       t        |«      }nä| j                  «       r| }nÑddddddd	œ}t        j                  d
v rt        j                  «       nd}t        j                  dv r$t        j                  dt        j                  «       |j!                  t        j                  |f«      }|€t#        dt        j                  › d|› �«      ‚t        t        «      j                  j                  |«      }|�|j%                  «       st#        d|› �«      ‚t        j                  d|«       |S )zÄDetermines the path of the correct Selenium Manager binary.

        :Returns: The Selenium Manager executable location

        :Raises: WebDriverException if the platform is unsupported
        zselenium-managerÚEXENÚSE_MANAGER_PATHz2Selenium Manager set by env SE_MANAGER_PATH to: %szmacos/selenium-managerzwindows/selenium-manager.exezlinux/selenium-manager))ÚdarwinÚany)Úwin32r   )Úcygwinr   )ÚlinuxÚx86_64)Úfreebsdr"   )Úopenbsdr"   )r!   r#   r$   r   )r#   r$   zFSelenium Manager binary may not be compatible with %s; verify settingsz/Unsupported platform/architecture combination: ú/z2Unable to obtain working Selenium Manager binary; z$Selenium Manager binary found at: %s)r   Ú__file__ÚparentÚjoinpathÚ	sysconfigÚget_config_varÚwith_suffixÚosÚgetenvr   ÚdebugÚexistsÚsysÚplatformÚmachineÚwarningÚgetr   Úis_file)Úcompiled_pathÚexeÚpathÚenv_pathÚallowedÚarchÚlocations          r   r   zSeleniumManager._get_binary8   su  € ô œX›×-Ñ-×6Ñ6Ð7IÓJˆÜ×&Ñ& uÓ-ˆØˆ?Ø)×5Ñ5°cÓ:ˆMà#ˆäŸ	™	Ð"3Ó4Ð4ˆHÐAÜ�L‰LÐMÈxÔXÜ˜“>‰DØ×!Ñ!Ô#Ø ‰Dð $<Ø"@Ø#AØ%=Ø'?Ø'?ñˆGô *-¯©Ð9XÑ)X”8×#Ñ#Ô%Ð^cˆDÜ�|‰|Ð5Ñ5Ü—‘ÐgÔil×iuÑiuÔvà—{‘{¤C§L¡L°$Ð#7Ó8ˆHØÐÜ(Ð+ZÔ[^×[gÑ[gÐZhÐhiÐjnÐioÐ)pÓqÐqäœ“>×(Ñ(×1Ñ1°(Ó;ˆDàˆ<˜tŸ|™|œ~Ü$Ð'YÐZ^ÐY_Ð%`ÓaÐaä�‰Ð;¸TÔBàˆr   c           
      ó²  — dj                  | «      }t        j                  d|«       	 t        j                  dk(  r't        j                  | dt
        j                  ¬«      }nt        j                  | d¬«      }|j                  j                  d«      j                  d«      }|j                  j                  d«      j                  d«      }|d	k7  rt        j                  |«      ng i d
œ}t         j#                  |d   «       |d   }|j$                  r!t        d|› d|j$                  › d|› d|› �«      ‚|S # t        $ r}t        d|› �«      |‚d}~ww xY w)z¾Executes the Selenium Manager Binary.

        :Args:
         - args: the components of the command being executed.
        :Returns: The log string containing the driver location.
        ú zExecuting process: %sr   T)Úcapture_outputÚcreationflags)r?   zutf-8ú
Ú )ÚlogsÚresultzUnsuccessful command executed: NrC   rD   z; code: )Újoinr   r.   r0   r1   Ú
subprocessÚrunÚCREATE_NO_WINDOWÚstdoutÚdecodeÚrstripÚstderrr   ÚloadsÚ	Exceptionr   r   Ú_process_logsÚ
returncode)r	   ÚcommandÚcompleted_procrI   rL   ÚoutputÚerrrD   s           r   r   zSeleniumManager._runh   sG  € ð —(‘(˜4“.ˆÜ�‰Ð,¨gÔ6ð		[Ü�|‰|˜wÒ&Ü!+§¡°ÀTÔYc×YtÑYtÔ!u‘ä!+§¡°ÀTÔ!J�Ø#×*Ñ*×1Ñ1°'Ó:×AÑAÀ$ÓGˆFØ#×*Ñ*×1Ñ1°'Ó:×AÑAÀ$ÓGˆFØ+1°Rª<”T—Z‘Z Ô'ÀbÐTVÑ=WˆFô 	×%Ñ% f¨V¡nÔ5Ø˜Ñ!ˆØ×$Ò$Ü$Ø1°'°¸(À>×C\ÑC\ÐB]Ð]_Ð`fÐ_gÐgiÐjpÐiqÐróð ð ˆøô ò 	[Ü$Ð'FÀwÀiÐ%PÓQÐWZÐZûð	[ús   ©CD9 Ä9	EÅEÅEÚ	log_itemsc                 ó”   — | D ]C  }|d   dk(  rt         j                  |d   «       Œ$|d   dv sŒ,t         j                  |d   «       ŒE y )NÚlevelÚWARNÚmessage)r   ÚINFO)r   r3   r.   )rU   Úitems     r   rO   zSeleniumManager._process_logs…   sJ   € àò 	.ˆDØ�G‰} Ò&Ü—‘˜t I™Õ/Ø�g‘Ð"3Ò3Ü—‘˜T )™_Õ-ñ		.r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Údictr   Ústaticmethodr   r   r   r   rO   © r   r   r   r       s{   „ ñð
 ð ¨$ó ð$ ð-˜ò -ó ð-ð^ ð�4˜‘9ð  ò ó ðð8 ð.  d¡ò .ó ñ.r   r   )r   r   r,   r1   rF   r0   r)   Úpathlibr   Útypingr   r   Úselenium.commonr   Ú	getLoggerr\   r   r   rb   r   r   ú<module>rg      sC   ðó" Û Û 	Û Û Û 
Û Ý ß !å .à	ˆ×	Ñ	˜8Ó	$€÷k.ò k.r   