§
    °õiˆ"  ã                   ó¢   — 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 d dlm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ d d	lmZ  G d
„ de¦  «        ZdS )é    N)Úcontextmanager)ÚBytesIO)ÚOptional)ÚDriverFinder)ÚOptions)ÚFirefoxRemoteConnection)ÚService)Ú	WebDriverc            	       óÞ   ‡ — e Zd ZdZdZdZ	 	 	 ddee         dee         de	d	dfˆ fd
„Z
dˆ fd„Zdd„Zed„ ¦   «         Zdd	efd„Zdd„Zd	e	fd„Zd	e	fd„Zd	efd„Zd	efd„Zd„ Zd„ Zd„ Zˆ xZS )r
   z=Controls the GeckoDriver and allows you to drive the browser.ÚchromeÚcontentNTÚoptionsÚserviceÚ
keep_aliveÚreturnc                 ól  •— |r|nt          ¦   «         | _        |r|nt          ¦   «         }t          | j        |¦  «        }|                     ¦   «         r |                     ¦   «         |_        d|_        | j                             ¦   «         p|                     ¦   «         | j        _	        | j         
                    ¦   «          t          | j        j        ||j        ¬¦  «        }	 t          ¦   «                              ||¬¦  «         n## t           $ r |                      ¦   «          ‚ w xY wd| _        dS )a–  Creates a new instance of the Firefox driver. Starts the service and
        then creates new instance of Firefox driver.

        Args:
            options: Instance of ``options.Options``.
            service: (Optional) service instance for managing the starting and stopping of the driver.
            keep_alive: Whether to configure remote_connection.RemoteConnection to use HTTP keep-alive.
        N)Úremote_server_addrr   Úignore_proxy)Úcommand_executorr   F)r	   r   r   r   Úget_browser_pathÚbinary_locationÚbrowser_versionÚenv_pathÚget_driver_pathÚpathÚstartr   Úservice_urlÚ_ignore_local_proxyÚsuperÚ__init__Ú	ExceptionÚquitÚ
_is_remote)Úselfr   r   r   ÚfinderÚexecutorÚ	__class__s         €úp/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/selenium/webdriver/firefox/webdriver.pyr    zWebDriver.__init__&   s+  ø€ ð #*Ð8�w�w­w©y¬yˆŒØ$Ð3�'�'­'©)¬)ˆå˜dœl¨GÑ4Ô4ˆØ×"Ò"Ñ$Ô$ð 	+Ø&,×&=Ò&=Ñ&?Ô&?ˆGÔ#Ø&*ˆGÔ#à œL×1Ò1Ñ3Ô3ÐO°v×7MÒ7MÑ7OÔ7OˆŒÔØŒ×ÒÑÔÐå*Ø#œ|Ô7Ø!Ø Ô4ð
ñ 
ô 
ˆð	Ý‰GŒG×Ò¨hÀÐÑHÔHÐHÐHøÝð 	ð 	ð 	Ø�IŠI‰KŒKˆKØð	øøøð  ˆŒˆˆs   Ã&#D
 Ä
 D*c                 óÚ   •— 	 t          ¦   «                              ¦   «          n# t          $ r Y nw xY w| j                             ¦   «          dS # | j                             ¦   «          w xY w)z=Closes the browser and shuts down the GeckoDriver executable.N)r   r"   r!   r   Ústop)r$   r'   s    €r(   r"   zWebDriver.quitN   sq   ø€ ð	 Ý‰GŒG�LŠL‰NŒNˆNˆNøÝð 	ð 	ð 	àˆDð	øøøð ŒL×ÒÑÔÐÐÐøˆDŒL×ÒÑÔÐÐøøøs!   ƒ $ £A ¤
1®A °1±A ÁA*c                 ó6   — |                       dd|i¦  «         dS )z¨Sets the context that Selenium commands are running in.

        Args:
            context: Context to set, should be one of CONTEXT_CHROME or CONTEXT_CONTENT.
        ÚSET_CONTEXTÚcontextN©Úexecute)r$   r-   s     r(   Úset_contextzWebDriver.set_contextX   s#   € ð 	�Š�] Y°Ð$8Ñ9Ô9Ð9Ð9Ð9ó    c              #   óì   K  — |                       d¦  «                             d¦  «        }|                      |¦  «         	 dV — |                      |¦  «         dS # |                      |¦  «         w xY w)aç  Sets the context that Selenium commands are running in using a
        `with` statement. The state of the context on the server is saved
        before entering the block, and restored upon exiting it.

        Args:
            context: Context, may be one of the class properties
                `CONTEXT_CHROME` or `CONTEXT_CONTENT`.

        Example:
            with selenium.context(selenium.CONTEXT_CHROME):
                # chrome scope
                ... do stuff ...
        ÚGET_CONTEXTÚvalueN)r/   Úpopr0   )r$   r-   Úinitial_contexts      r(   r-   zWebDriver.context`   s}   è è € ð Ÿ,š, }Ñ5Ô5×9Ò9¸'ÑBÔBˆØ×Ò˜Ñ!Ô!Ð!ð	.ØˆEˆEˆEà×Ò˜_Ñ-Ô-Ð-Ð-Ð-øˆD×Ò˜_Ñ-Ô-Ð-Ð-øøøs   ÁA ÁA3Fc           	      ój  — t           j                             |¦  «        �rt          ¦   «         }t           j                             |¦  «        }t          |¦  «        dz   }t          j        |dt          j        d¬¦  «        5 }t          j	        |¦  «        D ]I\  }}}|D ]@}	t           j         
                    ||	¦  «        }
|                     |
|
|d…         ¦  «         ŒAŒJ	 ddd¦  «         n# 1 swxY w Y   t          j        |                     ¦   «         ¦  «                             d¦  «        }nat!          |d¦  «        5 }t          j        |                     ¦   «         ¦  «                             d¦  «        }ddd¦  «         n# 1 swxY w Y   ||dœ}|                      d	|¦  «        d
         S )aÅ  Installs Firefox addon.

        Returns identifier of installed addon. This identifier can later
        be used to uninstall addon.

        Args:
            path: Absolute path to the addon that will be installed.
            temporary: Allows you to load browser extensions temporarily during a session.

        Returns:
            Identifier of installed addon.

        Example:
            driver.install_addon("/path/to/firebug.xpi")
        é   ÚwF)Ústrict_timestampsNzUTF-8Úrb)ÚaddonÚ	temporaryÚINSTALL_ADDONr4   )Úosr   Úisdirr   ÚnormpathÚlenÚzipfileÚZipFileÚZIP_DEFLATEDÚwalkÚjoinÚwriteÚbase64Ú	b64encodeÚgetvalueÚdecodeÚopenÚreadr/   )r$   r   r=   ÚfpÚ	path_rootÚzippedÚbaseÚ_ÚfilesÚfyleÚfilenamer<   ÚfileÚpayloads                 r(   Úinstall_addonzWebDriver.install_addonv   s#  € õ" Œ7�=Š=˜ÑÔñ 	FÝ‘”ˆBå”7×#Ò# DÑ)Ô)ˆDå˜D™	œ	 A™ˆIÝ”  S­'Ô*>ÐRWÐXÑXÔXð EÐ\bÝ&(¤g¨d¡m¤mð Eð E‘N�D˜!˜UØ %ð Eð E˜Ý#%¤7§<¢<°°dÑ#;Ô#;˜ØŸš X¨x¸	¸
¸
Ô/CÑDÔDÐDÐDðEðEðEð Eð Eñ Eô Eð Eð Eð Eð Eð Eð Eøøøð Eð Eð Eð Eõ
 Ô$ R§[¢[¡]¤]Ñ3Ô3×:Ò:¸7ÑCÔCˆEˆEå�d˜DÑ!Ô!ð F TÝÔ(¨¯ª©¬Ñ5Ô5×<Ò<¸WÑEÔE�ðFð Fð Fñ Fô Fð Fð Fð Fð Fð Fð Føøøð Fð Fð Fð Fð "°	Ð:Ð:ˆØ�|Š|˜O¨WÑ5Ô5°gÔ>Ð>s%   ÂAC.Ã.C2Ã5C2Å:F	Æ	FÆFc                 ó6   — |                       dd|i¦  «         dS )zÇUninstalls Firefox addon using its identifier.

        Args:
            identifier: The addon identifier to uninstall.

        Example:
            driver.uninstall_addon("addon@foo.com")
        ÚUNINSTALL_ADDONÚidNr.   )r$   Ú
identifiers     r(   Úuninstall_addonzWebDriver.uninstall_addonš   s$   € ð 	�ŠÐ&¨¨zÐ(:Ñ;Ô;Ð;Ð;Ð;r1   c                 ób  — |                      ¦   «                              d¦  «        st          j        dt          ¦  «         |                      ¦   «         }	 t          |d¦  «        5 }|                     |¦  «         ddd¦  «         n# 1 swxY w Y   n# t          $ r Y ~dS w xY w~n# ~w xY wdS )a®  Saves a full document screenshot of the current window to a PNG
        image file. Returns False if there is any IOError, else returns True.
        Use full paths in your filename.

        Args:
            filename: The full path you wish to save your screenshot to. This
                should end with a `.png` extension.

        Example:
            driver.get_full_page_screenshot_as_file("/Screenshots/foo.png")
        z.pngz^name used for saved screenshot does not match file type. It should end with a `.png` extensionÚwbNFT)	ÚlowerÚendswithÚwarningsÚwarnÚUserWarningÚget_full_page_screenshot_as_pngrM   rH   ÚOSError)r$   rV   ÚpngÚfs       r(   Ú get_full_page_screenshot_as_filez*WebDriver.get_full_page_screenshot_as_file¥   s  € ð �~Š~ÑÔ×(Ò(¨Ñ0Ô0ð 	ÝŒMØpÝñô ð ð ×2Ò2Ñ4Ô4ˆð	Ý�h Ñ%Ô%ð ¨Ø—’˜‘”�ðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð øøåð 	ð 	ð 	Øà��ð	øøøð �ø�ˆGˆGˆGˆGØˆtsN   ÁB Á'B	Á=B Â	BÂB ÂBÂB ÂB) Â
B$ÂB) Â#B$Â$B) Â)B,c                 ó,   — |                       |¦  «        S )a§  Saves a full document screenshot of the current window to a PNG
        image file. Returns False if there is any IOError, else returns True.
        Use full paths in your filename.

        Args:
            filename: The full path you wish to save your screenshot to. This
                should end with a `.png` extension.

        Example:
            driver.save_full_page_screenshot("/Screenshots/foo.png")
        )rj   )r$   rV   s     r(   Úsave_full_page_screenshotz#WebDriver.save_full_page_screenshotÀ   s   € ð ×4Ò4°XÑ>Ô>Ð>r1   c                 ót   — t          j        |                      ¦   «                              d¦  «        ¦  «        S )zÞGets the full document screenshot of the current window as a binary
        data.

        Returns:
            Binary data of the screenshot.

        Example:
            driver.get_full_page_screenshot_as_png()
        Úascii)rI   Ú	b64decodeÚ"get_full_page_screenshot_as_base64Úencode©r$   s    r(   rf   z)WebDriver.get_full_page_screenshot_as_pngÎ   s0   € õ Ô × GÒ GÑ IÔ I× PÒ PÐQXÑ YÔ YÑZÔZÐZr1   c                 ó8   — |                       d¦  «        d         S )a   Gets the full document screenshot of the current window as a base64
        encoded string which is useful in embedded images in HTML.

        Returns:
            Base64 encoded string of the screenshot.

        Example:
            driver.get_full_page_screenshot_as_base64()
        ÚFULL_PAGE_SCREENSHOTr4   r.   rr   s    r(   rp   z,WebDriver.get_full_page_screenshot_as_base64Ú   s   € ð �|Š|Ð2Ñ3Ô3°GÔ<Ð<r1   c                 ó   — t           ‚)zBDownload file functionality is not implemented for Firefox driver.©ÚNotImplementedError©r$   ÚargsÚkwargss      r(   Údownload_filezWebDriver.download_fileæ   ó   € å!Ð!r1   c                 ó   — t           ‚)zKGet downloadable files functionality is not implemented for Firefox driver.rv   rx   s      r(   Úget_downloadable_filesz WebDriver.get_downloadable_filesê   r|   r1   c                 ó   — t           ‚)zNDelete downloadable files functionality is not implemented for Firefox driver.rv   rx   s      r(   Údelete_downloadable_filesz#WebDriver.delete_downloadable_filesî   r|   r1   )NNT)r   N)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚCONTEXT_CHROMEÚCONTEXT_CONTENTr   r   r	   Úboolr    r"   r0   r   r-   ÚstrrY   r^   rj   rl   Úbytesrf   rp   r{   r~   r€   Ú__classcell__)r'   s   @r(   r
   r
       s®  ø€ € € € € ØGÐGà€NØ€Oð &*Ø%)Øð	& ð & à˜'Ô"ð& ð ˜'Ô"ð& ð ð	& ð
 
ð& ð & ð & ð & ð & ð & ðP ð  ð  ð  ð  ð  ð:ð :ð :ð :ð ð.ð .ñ „^ð.ð*"?ð "?°cð "?ð "?ð "?ð "?ðH	<ð 	<ð 	<ð 	<ð¸Dð ð ð ð ð6?°Tð ?ð ?ð ?ð ?ð
[°ð 
[ð 
[ð 
[ð 
[ð
=°Cð 
=ð 
=ð 
=ð 
=ð"ð "ð "ð"ð "ð "ð"ð "ð "ð "ð "ð "ð "r1   r
   )rI   r?   rc   rC   Ú
contextlibr   Úior   Útypingr   Ú'selenium.webdriver.common.driver_finderr   Ú"selenium.webdriver.firefox.optionsr   Ú,selenium.webdriver.firefox.remote_connectionr   Ú"selenium.webdriver.firefox.servicer	   Ú#selenium.webdriver.remote.webdriverr
   ÚRemoteWebDriver© r1   r(   ú<module>r•      sù   ðð" €€€Ø 	€	€	€	Ø €€€Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à @Ð @Ð @Ð @Ð @Ð @Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø PÐ PÐ PÐ PÐ PÐ PØ 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø LÐ LÐ LÐ LÐ LÐ LðP"ð P"ð P"ð P"ð P"�ñ P"ô P"ð P"ð P"ð P"r1   