ó
    ¼®iû  ã                   óV   • S SK r S SKrS SKJrJrJr  S SKJr  S SKJ	r	   " S S\	5      r
g)é    N)ÚBinaryIOÚOptionalÚUnion)ÚDesiredCapabilities)Ú
ArgOptionsc            	       ó¸  ^ • \ rS rSrSrSU 4S jjr\S\4S j5       r\R                  S\SS4S j5       r\S\
\   4S	 j5       r\R                  S\SS4S
 j5       r\S\\   4S j5       rS\SS4S jrS\SS4S jr\S\4S j5       rS\S\\\\\\   4   SS4S jr\S\4S j5       r\R                  S\SS4S j5       rS\4S jr\S\4S j5       rSrU =r$ )ÚChromiumOptionsé   zgoog:chromeOptionsÚreturnNc                 óv   >• [         TU ]  5         SU l        / U l        / U l        0 U l        SU l        SU l        g)z1Initialize ChromiumOptions with default settings.Ú NF)ÚsuperÚ__init__Ú_binary_locationÚ_extension_filesÚ_extensionsÚ_experimental_optionsÚ_debugger_addressÚ_enable_webextensions)ÚselfÚ	__class__s    €ÚPC:\des-py\RoboSAPF\venv\Lib\site-packages\selenium\webdriver\chromium\options.pyr   ÚChromiumOptions.__init__   s>   ø€ ä‰ÑÔØ%'ˆÔØ+-ˆÔØ&(ˆÔØRTˆÔ"Ø04ˆÔØ+0ˆÕ"ó    c                 ó   • U R                   $ )zE
Returns:
    The location of the binary, otherwise an empty string.
)r   ©r   s    r   Úbinary_locationÚChromiumOptions.binary_location'   s   € ð ×$Ñ$Ð$r   Úvaluec                 ód   • [        U[        5      (       d  [        U R                  5      eXl        g)zbAllows you to set where the chromium binary lives.

Args:
    value: Path to the Chromium binary.
N)Ú
isinstanceÚstrÚ	TypeErrorÚBINARY_LOCATION_ERRORr   ©r   r   s     r   r   r   /   s(   € ô ˜%¤×%Ñ%Ü˜D×6Ñ6Ó7Ð7Ø %Õr   c                 ó   • U R                   $ )z;
Returns:
    The address of the remote devtools instance.
)r   r   s    r   Údebugger_addressÚ ChromiumOptions.debugger_address:   s   € ð ×%Ñ%Ð%r   c                 óP   • [        U[        5      (       d  [        S5      eXl        g)zÛAllows you to set the address of the remote devtools instance that
the ChromeDriver instance will try to connect to during an active wait.

Args:
    value: Address of remote devtools instance if any (hostname[:port]).
z!Debugger Address must be a stringN)r!   r"   r#   r   r%   s     r   r'   r(   B   s#   € ô ˜%¤×%Ñ%ÜÐ?Ó@Ð@Ø!&Õr   c                 óæ   • S[         S[        4S jn/ nU R                   H/  n[        US5       nUR	                  U" U5      5        SSS5        M1     X R
                  -   $ ! , (       d  f       MP  = f)z@
Returns:
    A list of encoded extensions that will be loaded.
Ú	file_datar   c                 óh   • [         R                  " U R                  5       5      R                  S5      $ )Nzutf-8)Úbase64Ú	b64encodeÚreadÚdecode)r+   s    r   Ú_decodeÚ+ChromiumOptions.extensions.<locals>._decodeU   s'   € ô ×#Ò# I§N¡NÓ$4Ó5×<Ñ<¸WÓEÐEr   ÚrbN)r   r"   r   ÚopenÚappendr   )r   r1   Úencoded_extensionsÚ	extensionÚfs        r   Ú
extensionsÚChromiumOptions.extensionsN   sp   € ð	Fœxð 	F¬Cô 	Fð  ÐØ×.Ô.ˆIÜ�i Ô&¨!Ø"×)Ñ)©'°!«*Ô5÷ 'Ñ&ñ /ð "×$4Ñ$4Ñ4Ð4÷ 'Ö&ús   ¯A!Á!
A0	r7   c                 ó4  • U(       a‡  [         R                  R                  [         R                  R                  U5      5      n[         R                  R	                  U5      (       a  U R
                  R                  U5        g[        S5      e[        S5      e)z�Adds the path to the extension to a list that will be used to
extract it to the ChromeDriver.

Args:
    extension: Path to the \*.crx file.
z#Path to the extension doesn't existúargument can not be nullN)	ÚosÚpathÚabspathÚ
expanduserÚexistsr   r5   ÚOSErrorÚ
ValueError)r   r7   Úextension_to_adds      r   Úadd_extensionÚChromiumOptions.add_extensionb   sj   € ö Ü!Ÿw™wŸ™¬r¯w©w×/AÑ/AÀ)Ó/LÓMÐÜ�w‰w�~‰~Ð.×/Ñ/Ø×%Ñ%×,Ñ,Ð-=Õ>äÐCÓDÐDäÐ7Ó8Ð8r   c                 ó^   • U(       a  U R                   R                  U5        g[        S5      e)z¯Adds Base64 encoded string with extension data to a list that will
be used to extract it to the ChromeDriver.

Args:
    extension: Base64 encoded string with extension data.
r<   N)r   r5   rC   )r   r7   s     r   Úadd_encoded_extensionÚ%ChromiumOptions.add_encoded_extensionr   s'   € ö Ø×Ñ×#Ñ# IÕ.äÐ7Ó8Ð8r   c                 ó   • U R                   $ )zA
Returns:
    A dictionary of experimental options for chromium.
©r   r   s    r   Úexperimental_optionsÚ$ChromiumOptions.experimental_options~   s   € ð ×)Ñ)Ð)r   Únamec                 ó    • X R                   U'   g)z…Adds an experimental option which is passed to chromium.

Args:
    name: The experimental option name.
    value: The option value.
NrK   )r   rN   r   s      r   Úadd_experimental_optionÚ'ChromiumOptions.add_experimental_option†   s   € ð ,1×"Ñ" 4Ò(r   c                 ó   • U R                   $ )z‘
Returns:
    Whether webextension support is enabled for Chromium-based browsers.
    True if webextension support is enabled, False otherwise.
)r   r   s    r   Úenable_webextensionsÚ$ChromiumOptions.enable_webextensions�   s   € ð ×)Ñ)Ð)r   c                 óð   • Xl         U(       a0  SS/nU H%  nX0R                  ;  d  M  U R                  U5        M'     gSS/nU H/  nX0R                  ;   d  M  U R                  R                  U5        M1     g)a|  Enables or disables webextension support for Chromium-based browsers.

Args:
    value: True to enable webextension support, False to disable.

Notes:
    - When enabled, this automatically adds the required Chromium flags:
        - --enable-unsafe-extension-debugging
        - --remote-debugging-pipe
    - When disabled, this removes BOTH flags listed above, even if they were manually added via add_argument()
      before enabling webextensions.
    - Enabling --remote-debugging-pipe makes the connection b/w chromedriver
      and the browser use a pipe instead of a port, disabling many CDP functionalities
      like devtools
z#--enable-unsafe-extension-debuggingz--remote-debugging-pipeN)r   Ú
_argumentsÚadd_argumentÚremove)r   r   Úrequired_flagsÚflagÚflags_to_removes        r   rS   rT   ˜   sn   € ð" &+Ô"ÞàCÐE^Ð_ˆNÛ&�ØŸ™Õ.Ø×%Ñ% dÖ+ò 'ð
  EÐF_Ð`ˆOÛ'�ØŸ?™?Õ*Ø—O‘O×*Ñ*¨4Ö0ò (r   c                 ó‚  • U R                   nU R                  R                  5       nU R                  (       a  UR	                  U R                  5        U R
                  US'   U R                  (       a  U R                  US'   U R                  US'   U R                  (       a  U R                  US'   X!U R                  '   U$ )zqCreates a capabilities with all the options that have been set.

Returns:
    A dictionary with all set options.
r9   ÚbinaryÚargsÚdebuggerAddress)
Ú_capsrL   ÚcopyÚmobile_optionsÚupdater9   r   rV   r'   ÚKEY)r   ÚcapsÚchrome_optionss      r   Úto_capabilitiesÚChromiumOptions.to_capabilities·   s�   € ð �z‰zˆØ×2Ñ2×7Ñ7Ó9ˆØ××Ø×!Ñ! $×"5Ñ"5Ô6Ø'+§¡ˆ�|Ñ$Ø××Ø'+×';Ñ';ˆN˜8Ñ$Ø!%§¡ˆ�vÑØ× × Ø04×0EÑ0EˆNÐ,Ñ-à'ˆT�X‰X‰àˆr   c                 ó>   • [         R                  R                  5       $ )N)r   ÚCHROMEra   r   s    r   Údefault_capabilitiesÚ$ChromiumOptions.default_capabilitiesÌ   s   € ä"×)Ñ)×.Ñ.Ó0Ð0r   )r   r   r   r   r   r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rd   r   Úpropertyr"   r   Úsetterr   r'   Úlistr9   rE   rH   ÚdictrL   r   ÚintrP   ÚboolrS   rg   rk   Ú__static_attributes__Ú__classcell__)r   s   @r   r	   r	      s�  ø† Ø
€C÷1ð ð% ó %ó ð%ð ×Ñð& Sð &¨Tó &ó ð&ð ð& (¨3¡-ó &ó ð&ð ×Ñð	' cð 	'¨dó 	'ó ð	'ð ð5˜D ™Ió 5ó ð5ð&9 sð 9¨tô 9ð 
9¨sð 
9°tô 
9ð ð* dó *ó ð*ð1¨Cð 1¸¸cÀ3ÈÈdÐSVÉiÐ>WÑ8Xð 1Ð]aô 1ð ð* dó *ó ð*ð × Ñ ð1¨$ð 1°4ó 1ó !ð1ð< ô ð* ð1 dó 1ó ö1r   r	   )r-   r=   Útypingr   r   r   Ú.selenium.webdriver.common.desired_capabilitiesr   Ú!selenium.webdriver.common.optionsr   r	   © r   r   Ú<module>r}      s'   ðó$ Û 	ß ,Ñ ,å NÝ 8ôt1�jõ t1r   