Ë
    bQbjb  ã                   óN   — d dl Z d dlZd dlmZ d dlmZ d dlmZ  G d„ de«      Zy)é    N)ÚBinaryIO)ÚDesiredCapabilities)Ú
ArgOptionsc                   ó–  ‡ — e Zd ZdZdˆ fd„Zedefd„«       Zej                  deddfd„«       Zededz  fd„«       Z	e	j                  deddfd	„«       Z	ede
e   fd
„«       Zdeddfd„Zdeddfd„Zedefd„«       Zdedeez  ez  e
e   z  ddfd„Zedefd„«       Zej                  deddfd„«       Zdefd„Zedefd„«       Zˆ xZS )ÚChromiumOptionszgoog:chromeOptionsÚreturnNc                 óv   •— t         ‰| �  «        d| _        g | _        g | _        i | _        d| _        d| _        y)z1Initialize ChromiumOptions with default settings.Ú NF)ÚsuperÚ__init__Ú_binary_locationÚ_extension_filesÚ_extensionsÚ_experimental_optionsÚ_debugger_addressÚ_enable_webextensions)ÚselfÚ	__class__s    €úV/var/www/html/venv/lib/python3.12/site-packages/selenium/webdriver/chromium/options.pyr   zChromiumOptions.__init__   s>   ø€ ä‰ÑÔØ%'ˆÔØ+-ˆÔØ&(ˆÔØNPˆÔ"Ø-1ˆÔØ+0ˆÕ"ó    c                 ó   — | j                   S )z>Returns the location of the binary, otherwise an empty string.)r   ©r   s    r   Úbinary_locationzChromiumOptions.binary_location'   s   € ð ×$Ñ$Ð$r   Úvaluec                 ó\   — t        |t        «      st        | j                  «      ‚|| _        y)zzAllows 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   zChromiumOptions.binary_location,   s'   € ô ˜%¤Ô%Ü˜D×6Ñ6Ó7Ð7Ø %ˆÕr   c                 ó   — | j                   S )z4Returns the address of the remote devtools instance.)r   r   s    r   Údebugger_addressz ChromiumOptions.debugger_address7   s   € ð ×%Ñ%Ð%r   c                 óH   — t        |t        «      st        d«      ‚|| _        y)z´Set the address of the remote devtools instance for active wait connection.

        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"   z ChromiumOptions.debugger_address<   s"   € ô ˜%¤Ô%ÜÐ?Ó@Ð@Ø!&ˆÕr   c                 óÖ   — dt         dt        fd„}g }| j                  D ].  }t        |d«      5 }|j	                   ||«      «       ddd«       Œ0 || j
                  z   S # 1 sw Y   ŒIxY w)z9Returns a list of encoded extensions that will be loaded.Ú	file_datar   c                 óf   — t        j                  | j                  «       «      j                  d«      S )Nzutf-8)Úbase64Ú	b64encodeÚreadÚdecode)r%   s    r   Ú_decodez+ChromiumOptions.extensions.<locals>._decodeK   s'   € ô ×#Ñ# I§N¡NÓ$4Ó5×<Ñ<¸WÓEÐEr   ÚrbN)r   r   r   ÚopenÚappendr   )r   r+   Úencoded_extensionsÚ	extensionÚfs        r   Ú
extensionszChromiumOptions.extensionsG   s€   € ð	Fœxð 	F¬Có 	Fð  ÐØ×.Ñ.ò 	6ˆIÜ�i Ó&ð 6¨!Ø"×)Ñ)©'°!«*Ô5÷6ð 6ð	6ð " D×$4Ñ$4Ñ4Ð4÷6ð 6ús   ®AÁA(	r0   c                 ó   — |r‚t         j                  j                  t         j                  j                  |«      «      }t         j                  j	                  |«      r| j
                  j                  |«       yt        d«      ‚t        d«      ‚)z„Add the path to an extension to be extracted to 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   r.   ÚOSErrorÚ
ValueError)r   r0   Úextension_to_adds      r   Úadd_extensionzChromiumOptions.add_extensionX   sg   € ñ Ü!Ÿw™wŸ™¬r¯w©w×/AÑ/AÀ)Ó/LÓMÐÜ�w‰w�~‰~Ð.Ô/Ø×%Ñ%×,Ñ,Ð-=Õ>äÐCÓDÐDäÐ7Ó8Ð8r   c                 óT   — |r| j                   j                  |«       yt        d«      ‚)z¨Add Base64-encoded string with extension data to be extracted to ChromeDriver.

        Args:
            extension: Base64 encoded string with extension data.
        r4   N)r   r.   r;   )r   r0   s     r   Úadd_encoded_extensionz%ChromiumOptions.add_encoded_extensiong   s'   € ñ Ø×Ñ×#Ñ# IÕ.äÐ7Ó8Ð8r   c                 ó   — | j                   S )z:Returns a dictionary of experimental options for chromium.©r   r   s    r   Úexperimental_optionsz$ChromiumOptions.experimental_optionsr   ó   € ð ×)Ñ)Ð)r   Únamec                 ó"   — || j                   |<   y)z¥Adds an experimental option which is passed to chromium.

        Args:
            name: The experimental option name.
            value: The option value.
        NrA   )r   rD   r   s      r   Úadd_experimental_optionz'ChromiumOptions.add_experimental_optionw   s   € ð ,1ˆ×"Ñ" 4Ò(r   c                 ó   — | j                   S )zKReturn whether webextension support is enabled for Chromium-based browsers.)r   r   s    r   Úenable_webextensionsz$ChromiumOptions.enable_webextensions€   rC   r   c                 óØ   — || _         |r,ddg}|D ]"  }|| j                  vsŒ| j                  |«       Œ$ yddg}|D ],  }|| j                  v sŒ| j                  j                  |«       Œ. y)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   rH   z$ChromiumOptions.enable_webextensions…   s~   € ð" &+ˆÔ"ÙàCÐE^Ð_ˆNØ&ò ,�Ø˜tŸ™Ò.Ø×%Ñ% dÕ+ñ,ð
  EÐF_Ð`ˆOØ'ò 1�Ø˜4Ÿ?™?Ò*Ø—O‘O×*Ñ*¨4Õ0ñ1r   c                 óf  — | j                   }| j                  j                  «       }| j                  r|j	                  | j                  «       | j
                  |d<   | j                  r| j                  |d<   | j                  |d<   | j                  r| j                  |d<   ||| j                  <   |S )z‰Creates a capabilities with all the options that have been set.

        Returns:
            A dictionary with all set options.
        r2   ÚbinaryÚargsÚdebuggerAddress)
Ú_capsrB   ÚcopyÚmobile_optionsÚupdater2   r   rJ   r"   ÚKEY)r   ÚcapsÚchrome_optionss      r   Úto_capabilitiesz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                 ó>   — t         j                  j                  «       S )N)r   ÚCHROMErU   r   s    r   Údefault_capabilitiesz$ChromiumOptions.default_capabilities¹   s   € ä"×)Ñ)×.Ñ.Ó0Ð0r   )r   N)Ú__name__Ú
__module__Ú__qualname__rX   r   Úpropertyr   r   Úsetterr"   Úlistr2   r=   r?   ÚdictrB   ÚintrF   ÚboolrH   r[   r^   Ú__classcell__)r   s   @r   r   r      s�  ø„ Ø
€Cõ1ð ð% ò %ó ð%ð ×Ñð& Sð &¨Tò &ó ð&ð ð& #¨¡*ò &ó ð&ð ×Ñð' cð '¨dò 'ó ð'ð ð5˜D ™Iò 5ó ð5ð 9 sð 9¨tó 9ð	9¨sð 	9°tó 	9ð ð* dò *ó ð*ð1¨Cð 1¸¸c¹	ÀDÑ8HÈ4ÐPSÉ9Ñ8Tð 1ÐY]ó 1ð ð* dò *ó ð*ð × Ñ ð1¨$ð 1°4ò 1ó !ð1ð< ó ð* ð1 dò 1ó ô1r   r   )	r'   r5   Útypingr   Ú.selenium.webdriver.common.desired_capabilitiesr   Ú!selenium.webdriver.common.optionsr   r   © r   r   ú<module>rm      s$   ðó$ Û 	Ý å NÝ 8ôa1�jõ a1r   