Ë
    `§1hm  ã                   óš   — 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y)é    N)Úcontextmanager)ÚBytesIO)ÚOptional)ÚDriverFinder)Ú	WebDriveré   )ÚOptions)ÚFirefoxRemoteConnection)ÚServicec            	       óÆ   ‡ — 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ˆ xZS )r   z=Controls the GeckoDriver and allows you to drive the browser.ÚchromeÚcontentNÚoptionsÚserviceÚ
keep_aliveÚreturnc                 ó<  •— |r|n	t        «       | _        |r|n	t        «       }t        | j                  |«      }|j	                  «       r|j	                  «       |_        d|_        | j                  j                  «       xs |j                  «       | j                  _	        | j                  j                  «        t        | j                  j                  ||j                  ¬«      }	 t        ‰| �=  ||¬«       d| _        y# t         $ r | j#                  «        ‚ w xY w)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         €úb/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/selenium/webdriver/firefox/webdriver.pyr!   zWebDriver.__init__'   sé   ø€ ñ #*‘w¬w«yˆŒÙ$‘'¬'«)ˆä˜dŸl™l¨GÓ4ˆØ×"Ñ"Ô$Ø&,×&=Ñ&=Ó&?ˆGÔ#Ø&*ˆGÔ#à ŸL™L×1Ñ1Ó3ÒO°v×7MÑ7MÓ7Oˆ�‰ÔØ�‰×ÑÔä*Ø#Ÿ|™|×7Ñ7Ø!Ø ×4Ñ4ô
ˆð	Ü‰GÑ¨hÀÐÔHð
  ˆ�øô	 ò 	Ø�I‰IŒKØð	ús   Ã'D  Ä Dc                 ó´   •— 	 t         ‰| �  «        | j                  j	                  «        y# t        $ r Y Œ&w xY w# | j                  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.quitO   sJ   ø€ ð	 Ü‰G‰LŒNð
 �L‰L×ÑÕøô	 ò 	áð	ûð �L‰L×ÑÕús   ƒ, ¬	8µ; ·8¸; »Ac                 ó,   — | j                  dd|i«       y )NÚSET_CONTEXTÚcontext©Úexecute)r%   r.   s     r)   Úset_contextzWebDriver.set_contextY   s   € Ø�‰�] Y°Ð$8Õ9ó    c              #   óÆ   K  — | j                  d«      j                  d«      }| j                  |«       	 d–— | j                  |«       y# | j                  |«       w xY w­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.

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

        Usage example::

            with selenium.context(selenium.CONTEXT_CHROME):
                # chrome scope
                ... do stuff ...
        ÚGET_CONTEXTÚvalueN)r0   Úpopr1   )r%   r.   Úinitial_contexts      r)   r.   zWebDriver.context\   sS   è ø€ ð Ÿ,™, }Ó5×9Ñ9¸'ÓBˆØ×Ñ˜Ô!ð	.Ûà×Ñ˜_Õ-øˆD×Ñ˜_Õ-üs   ‚2A!µA ¹A!ÁAÁA!c           	      ó  — t         j                  j                  |«      rõt        «       }t         j                  j	                  |«      }t        |«      dz   }t        j                  |dt        j                  d¬«      5 }t        j                  |«      D ]B  \  }}}|D ]7  }	t         j                  j                  ||	«      }
|j                  |
|
|d «       Œ9 ŒD 	 ddd«       t        j                  |j                  «       «      j                  d«      }nGt!        |d«      5 }t        j                  |j#                  «       «      j                  d«      }ddd«       |dœ}| j%                  d	|«      d
   S # 1 sw Y   Œ�xY w# 1 sw Y   Œ/xY w)a’  Installs Firefox addon.

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

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

        :Usage:
            ::

                driver.install_addon("/path/to/firebug.xpi")
        r   ÚwF)Ústrict_timestampsNzUTF-8Úrb)ÚaddonÚ	temporaryÚINSTALL_ADDONr5   )Úosr   Úisdirr   ÚnormpathÚlenÚzipfileÚZipFileÚZIP_DEFLATEDÚwalkÚjoinÚwriteÚbase64Ú	b64encodeÚgetvalueÚdecodeÚopenÚreadr0   )r%   r   r=   ÚfpÚ	path_rootÚzippedÚbaseÚ_ÚfilesÚfyleÚfilenamer<   ÚfileÚpayloads                 r)   Úinstall_addonzWebDriver.install_addonr   sU  € ô �7‰7�=‰=˜ÔÜ“ˆBä—7‘7×#Ñ# DÓ)ˆDä˜D›	 A™ˆIÜ—‘  S¬'×*>Ñ*>ÐRWÔXð EÐ\bÜ&(§g¡g¨d£mò E‘N�D˜!˜UØ %ò E˜Ü#%§7¡7§<¡<°°dÓ#;˜ØŸ™ X¨x¸	¸
Ð/CÕDñEñE÷Eô
 ×$Ñ$ R§[¡[£]Ó3×:Ñ:¸7ÓC‰Eä�d˜DÓ!ð F TÜ×(Ñ(¨¯©«Ó5×<Ñ<¸WÓE�÷Fð "°	Ñ:ˆØ�|‰|˜O¨WÓ5°gÑ>Ð>÷Eð Eú÷Fð Fús   Á>AE6Ä!3FÅ6E?ÆFc                 ó,   — | j                  dd|i«       y)z�Uninstalls Firefox addon using its identifier.

        :Usage:
            ::

                driver.uninstall_addon("addon@foo.com")
        ÚUNINSTALL_ADDONÚidNr/   )r%   Ú
identifiers     r)   Úuninstall_addonzWebDriver.uninstall_addon”   s   € ð 	�‰Ð&¨¨zÐ(:Õ;r2   c                 ó*  — |j                  «       j                  d«      st        j                  dt        «       | j                  «       }	 t        |d«      5 }|j                  |«       ddd«       ~y# 1 sw Y   ŒxY w# t        $ r Y ~yw xY w# ~w xY w)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.

        :Usage:
            ::

                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Ü�M‰MØpÜôð ×2Ñ2Ó4ˆð	Ü�h Ó%ð ¨Ø—‘˜”÷ð
 Ø÷ð ûäò 	Øáð	ûñ ús<   ÁA? ÁA3Á)A? Á3A<Á8A? Á?	BÂB ÂBÂB ÂBc                 ó$   — | j                  |«      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.

        :Usage:
            ::

                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Ó>Ð>r2   c                 óf   — t        j                  | j                  «       j                  d«      «      S )z´Gets the full document screenshot of the current window as a binary
        data.

        :Usage:
            ::

                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Ë   s*   € ô ×Ñ × GÑ GÓ I× PÑ PÐQXÓ YÓZÐZr2   c                 ó*   — | j                  d«      d   S )zìGets the full document screenshot of the current window as a base64
        encoded string which is useful in embedded images in HTML.

        :Usage:
            ::

                driver.get_full_page_screenshot_as_base64()
        ÚFULL_PAGE_SCREENSHOTr5   r/   rr   s    r)   rp   z,WebDriver.get_full_page_screenshot_as_base64Ö   s   € ð �|‰|Ð2Ó3°GÑ<Ð<r2   c                 ó   — t         ‚©N©ÚNotImplementedError©r%   ÚargsÚkwargss      r)   Údownload_filezWebDriver.download_fileá   ó   € Ü!Ð!r2   c                 ó   — t         ‚rv   rw   ry   s      r)   Úget_downloadable_filesz WebDriver.get_downloadable_filesä   r}   r2   )NNT)r   N)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚCONTEXT_CHROMEÚCONTEXT_CONTENTr   r	   r   Úboolr!   r#   r1   r   r.   ÚstrrY   r^   rj   rl   Úbytesrf   rp   r|   r   Ú__classcell__)r(   s   @r)   r   r   !   s½   ø„ ÙGà€NØ€Oð &*Ø%)Øñ	& à˜'Ñ"ð& ð ˜'Ñ"ð& ð ð	& ð
 
õ& õP ó:ð ñ.ó ð.ñ* ?°có  ?óD<ð¸Dó ð:?°Tó ?ð 	[°ó 	[ð	=°Có 	=ò"ö"r2   r   )rI   r?   rc   rC   Ú
contextlibr   Úior   Útypingr   Ú'selenium.webdriver.common.driver_finderr   Ú#selenium.webdriver.remote.webdriverr   ÚRemoteWebDriverr   r	   Úremote_connectionr
   r   r   © r2   r)   ú<module>r’      s9   ðó" Û 	Û Û Ý %Ý Ý å @Ý Lå Ý 6Ý ôD"�õ D"r2   