
    vKgO                     ~    S SK r S SKrS SKJr  S SKJr  S SK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)    N)BinaryIO)Dict)List)Optional)Union)DesiredCapabilities)
ArgOptionsc            	       p  ^  \ 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r\S\4S j5       rSrU =r$ )ChromiumOptions   zgoog:chromeOptionsreturnNc                 h   > [         TU ]  5         SU l        / U l        / U l        0 U l        S U l        g )N )super__init___binary_location_extension_files_extensions_experimental_options_debugger_address)self	__class__s    c/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/selenium/webdriver/chromium/options.pyr   ChromiumOptions.__init__!   s6    %'+-&(RT"04    c                     U R                   $ )z@: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)zaAllows 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                   $ )z6:Returns: The address of the remote devtools instance.)r   r   s    r   debugger_address ChromiumOptions.debugger_address9   s     %%%r   c                 P    [        U[        5      (       d  [        S5      eXl        g)zAllows 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)   >   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>._decodeN   s'     ##INN$45<<WEEr   rbN)r   r#   r   openappendr   )r   r2   encoded_extensions	extensionfs        r   
extensionsChromiumOptions.extensionsJ   sp    	Fx 	FC 	F  ..Ii&!"))'!*5 '& / "$4$444 '&s   A!!
A0	r8   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)zAdds 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   r6   OSError
ValueError)r   r8   extension_to_adds      r   add_extensionChromiumOptions.add_extension[   sj     !wwrww/A/A)/LMww~~.//%%,,-=>CDD788r   c                 ^    U(       a  U R                   R                  U5        g[        S5      e)zAdds 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   r6   rD   )r   r8   s     r   add_encoded_extension%ChromiumOptions.add_encoded_extensionk   s'     ##I.788r   c                     U R                   $ )z<:Returns: A dictionary of experimental options for chromium.r   r   s    r   experimental_options$ChromiumOptions.experimental_optionsw   s     )))r   namec                      X R                   U'   g)zAdds an experimental option which is passed to chromium.

:Args:
  name: The experimental option name.
  value: The option value.
NrL   )r   rO   r    s      r   add_experimental_option'ChromiumOptions.add_experimental_option|   s     ,1""4(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$ )zfCreates a capabilities with all the options that have been set
:Returns: A dictionary with everything.r:   binaryargsdebuggerAddress)
_capsrM   copymobile_optionsupdater:   r   
_argumentsr(   KEY)r   capschrome_optionss      r   to_capabilitiesChromiumOptions.to_capabilities   s     zz22779!!$"5"56'+|$'+';';N8$!%v  040E0EN,-'TXXr   c                 >    [         R                  R                  5       $ )N)r   CHROMErX   r   s    r   default_capabilities$ChromiumOptions.default_capabilities   s    "))..00r   )r   r   r   r   r   )r   N)__name__
__module____qualname____firstlineno__r\   r   propertyr#   r   setterr   r(   r   r:   rF   rI   dictrM   r   intrQ   r_   rc   __static_attributes____classcell__)r   s   @r   r   r      sL   
C5 % % % &S &T & & &(3- & & 	'c 	'd 	' 	' 5DI 5 5 9s 9t 9 
9s 
9t 
9 *d * *1C 1c3dSVi>W8X 1]a 1 $ 1d 1 1r   r   )r.   r>   typingr   r   r   r   r   .selenium.webdriver.common.desired_capabilitiesr   !selenium.webdriver.common.optionsr	   r    r   r   <module>rs      s0   $  	      N 8{1j {1r   