ó
    ¾®iü5  ã                   óÈ   • S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKr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r\" S5       " S S	\5      5       r " S
 S5      rg)é    N)ÚBytesIO)Úminidom)Ú
deprecated)ÚWebDriverExceptionzwebdriver_prefs.jsonú/Addons must be added after starting the sessionc                   ó   • \ rS rSrSrSrg)ÚAddonFormatErroré&   z4Exception for not well-formed add-on manifest files.© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚWC:\des-py\RoboSAPF\venv\Lib\site-packages\selenium\webdriver\firefox\firefox_profile.pyr	   r	   &   s   † ä>r   r	   c                   óä  • \ rS rSrSrSS jrS r\" S5      SS j5       rS r	\
S 5       r\
\" S	5      S
 5       5       r\R                  \" S	5      SS j5       5       r\
\" S5      S 5       5       r\R                  \" S5      SS j5       5       r\
\" S5      S 5       5       r\R                  \" S5      SS j5       5       r\
S\4S j5       rS r\" S5      SS j5       r\" S5      S 5       rSrg)ÚFirefoxProfileé+   Nc           	      ó^  • 0 U l         U(       a†  [        R                  R                  [        R
                  " 5       S5      n[        R                  " X[        R                  " SSS5      S9  X l	        [        R                  " U R                  S5        g	[        R
                  " 5       U l	        [        R                  (       du  [        [        R                  R                  [        R                  R                  [        5      [         5      SS9 n["        R$                  " U5      [        l        S	S	S	5        [&        R(                  " [        R                  S
   5      U l         [        R                  S   R+                  5        H  u  pEXPR                   U'   M     g	! , (       d  f       Ns= f)a]  Initialises a new instance of a Firefox Profile.

Args:
    profile_directory: Directory of profile that you want to use. If a
        directory is passed in it will be cloned and the cloned directory
        will be used by the driver when instantiated.
        This defaults to None and will create a new
        directory when object is created.
zwebdriver-py-profilecopyzparent.lockÚlockz.parentlock)Úignoreéí  úutf-8©ÚencodingNÚmutableÚfrozen)Ú_desired_preferencesÚosÚpathÚjoinÚtempfileÚmkdtempÚshutilÚcopytreeÚignore_patternsÚ_profile_dirÚchmodr   ÚDEFAULT_PREFERENCESÚopenÚdirnameÚ__file__ÚWEBDRIVER_PREFERENCESÚjsonÚloadÚcopyÚdeepcopyÚitems)ÚselfÚprofile_directoryÚnewprofÚdefault_prefsÚkeyÚvalues         r   Ú__init__ÚFirefoxProfile.__init__.   s"  € ð %'ˆÔ!ÞÜ—g‘g—l‘l¤8×#3Ò#3Ó#5Ð7QÓRˆGÜ�OŠOØ!´6×3IÒ3IÈ-ÐY_ÐanÓ3oòð !(ÔÜ�HŠH�T×&Ñ&¨Õ.ä (× 0Ò 0Ó 2ˆDÔÜ!×5×5ÜÜ—G‘G—L‘L¤§¡§¡´Ó!:Ô<QÓRÐ]dòà"Ü9=¿ºÀ=Ó9Q”NÔ6÷ô
 )-¯ª´n×6XÑ6XÐYbÑ6cÓ(dˆDÔ%Ü,×@Ñ@ÀÑJ×PÑPÖR‘
�Ø16×)Ñ)¨#Ó.ò S÷õ ús   Ä FÆ
F,c                 ó    • X R                   U'   g)z0Sets the preference that we want in the profile.N©r    )r5   r9   r:   s      r   Úset_preferenceÚFirefoxProfile.set_preferenceM   s   € à).×!Ñ! #Ò&r   r   c                 ó&   • U R                  U5        g ©N)Ú_install_extension)r5   Ú	extensions     r   Úadd_extensionÚFirefoxProfile.add_extensionQ   s   € à×Ñ 	Õ*r   c           
      óØ  • [         R                  R                  U R                  S5      n[         R                  R	                  U5      (       a(  [         R
                  " US5        U R                  U5        [        USSS9 nU R                  R                  5        H1  u  p4UR                  SU S[        R                  " U5       S35        M3     S	S	S	5        g	! , (       d  f       g	= f)
z&Writes the desired user prefs to disk.zuser.jsi¤  Úwr   r   zuser_pref("z", z);
N)r!   r"   r#   r)   Úisfiler*   Ú_read_existing_userjsr,   r    r4   Úwriter0   Údumps)r5   Ú
user_prefsÚfr9   r:   s        r   Úupdate_preferencesÚ!FirefoxProfile.update_preferencesU   s¦   € ä—W‘W—\‘\ $×"3Ñ"3°YÓ?ˆ
Ü�7‰7�>‰>˜*×%Ñ%Ü�HŠH�Z Ô'Ø×&Ñ& zÔ2Ü�*˜c¨GÒ4¸Ø"×7Ñ7×=Ñ=Ö?‘
�Ø—‘˜+ c U¨#¬d¯jªj¸Ó.?Ð-@ÀÐEÖFñ @÷ 5×4Ö4ús   ÂACÃ
C)c                 ó   • U R                   $ )z8Gets the profile directory that is currently being used.)r)   ©r5   s    r   r"   ÚFirefoxProfile.patha   s   € ð × Ñ Ð r   z'The port is stored in the Service classc                 ó   • U R                   $ )z+Gets the port that WebDriver is working on.)Ú_portrR   s    r   ÚportÚFirefoxProfile.portf   s   € ð �z‰zÐr   Úreturnc                 ó  • [        U[        5      (       d  [        S5      e [        U5      nUS:  d  US:”  a  [        S5      e Xl        U R                  SU R
                  5        g! [        [        4 a    [        S5      ef = f)z0Sets the port that WebDriver will be running on.zPort needs to be an integeré   iÿÿ  z)Port number must be in the range 1..65535Úwebdriver_firefox_portN)Ú
isinstanceÚintr   Ú
ValueErrorÚ	TypeErrorrU   r?   )r5   rV   s     r   rV   rW   l   sŠ   € ô ˜$¤×$Ñ$Ü$Ð%BÓCÐCð	DÜ�t“9ˆDØ�a‹x˜4 %›<Ü(Ð)TÓUÐUð (ð Œ
Ø×ÑÐ4°d·j±jÕAøô œIÐ&ó 	DÜ$Ð%BÓCÐCð	Dús   ¢"A( Á(Bz8Allowing untrusted certs is toggled in the Options classc                 ó    • U R                   S   $ )NÚ webdriver_accept_untrusted_certsr>   rR   s    r   Úaccept_untrusted_certsÚ%FirefoxProfile.accept_untrusted_certs{   s   € ð ×(Ñ(Ð)KÑLÐLr   c                 óh   • [        U[        5      (       d  [        S5      eU R                  SU5        g )Nú%Please pass in a Boolean to this callra   ©r\   Úboolr   r?   ©r5   r:   s     r   rb   rc   €   s.   € ô ˜%¤×&Ñ&Ü$Ð%LÓMÐMØ×ÑÐ>ÀÕFr   c                 ó    • U R                   S   $ )NÚ!webdriver_assume_untrusted_issuerr>   rR   s    r   Úassume_untrusted_cert_issuerÚ+FirefoxProfile.assume_untrusted_cert_issuer‡   s   € ð ×(Ñ(Ð)LÑMÐMr   c                 óh   • [        U[        5      (       d  [        S5      eU R                  SU5        g )Nre   rj   rf   rh   s     r   rk   rl   Œ   s.   € ô ˜%¤×&Ñ&Ü$Ð%LÓMÐMà×ÑÐ?ÀÕGr   c           	      ó8  • U R                   (       a  U R                  5         [        5       n[        R                  " US[        R
                  SS9 n[        U R                  5      S-   n[        R                  " U R                  5       HB  u  pEnU H6  n[        R                  R                  XG5      nUR                  XˆUS 5        M8     MD     SSS5        [        R                  " UR                  5       5      R                  S5      $ ! , (       d  f       NA= f)zUUpdates preferences and creates a zipped, base64 encoded string of
profile directory.rH   F)Ústrict_timestampsrZ   NzUTF-8)r    rO   r   ÚzipfileÚZipFileÚZIP_DEFLATEDÚlenr"   r!   Úwalkr#   rK   Úbase64Ú	b64encodeÚgetvalueÚdecode)	r5   ÚfpÚzippedÚ	path_rootÚbaseÚ_ÚfilesÚfyleÚfilenames	            r   ÚencodedÚFirefoxProfile.encoded”   sË   € ð ×$×$Ø×#Ñ#Ô%Ü‹YˆÜ�_Š_˜R ¤g×&:Ñ&:ÈeÒTÐX^Ü˜DŸI™I›¨Ñ*ˆIÜ"$§'¢'¨$¯)©)Ö"4‘�˜Û!�DÜ!Ÿw™wŸ|™|¨DÓ7�HØ—L‘L °I°JÐ+?Ö@ó "ñ #5÷ Uô ×Ò §¡£Ó.×5Ñ5°gÓ>Ð>÷ UÕTús   ÁA?DÄ
Dc           
      óÆ  • [         R                  " S5      n[        USS9 nU HV  nUR                  U5      n [        R
                  " UR                  S5      5      U R                  UR                  S5      '   MX     SSS5        g! [         a>    [        R                  " SUR                  S5      UR                  S5      -    35         Mª  f = f! , (       d  f       g= f)zJReads existing preferences and adds them to desired preference
dictionary.zuser_pref\("(.*)",\s(.*)\)r   r   é   rZ   z5(skipping) failed to json.loads existing preference: N)ÚreÚcompiler,   Úsearchr0   ÚloadsÚgroupr    Ú	ExceptionÚwarningsÚwarn)r5   ÚuserjsÚpref_patternrN   ÚusrÚmatchess         r   rJ   Ú$FirefoxProfile._read_existing_userjs£   sÂ   € ô —z’zÐ"?Ó@ˆÜ�& 7Ò+¨qÛ�Ø&×-Ñ-¨cÓ2�ðÜBFÇ*Â*ÈWÏ]É]Ð[\ÓM]ÓB^�D×-Ñ-¨g¯m©m¸AÓ.>Ó?ñ ÷ ,Ð+øô
 !ó Ü—M’MØOÐPW×P]ÑP]Ð^_ÓP`Ðcj×cpÑcpÐqrÓcsÑPsÐOtÐu÷ðú÷ ,Õ+ús0   ¡C¹ABÁ:CÂACÃCÃCÃCÃ
C c           	      ó  • SnSnUR                  S5      (       Gaû  [        R                  " S[        R                  R                  U5      S   -   S9n[        R                  " US5      nUR                  5        GH”  nUR                  S5      (       ax  [        R                  R                  [        R                  R                  X65      5      (       d5  [        R                  " [        R                  R                  X65      5        M�  M’  [        R                  R                  [        R                  R                  [        R                  R                  X65      5      5      (       dP  [        R                  " [        R                  R                  [        R                  R                  X65      5      5        UR                  U5      n[        [        R                  R                  X65      S5       nUR                  U5        SSS5        GM—     UnUnU R!                  U5      n	U	R#                  S	5      n
U
(       d
   S
U 35       e[        R                  R                  U R$                  S5      n[        R                  R                  Xº5      nU(       d|  U	S   (       dr  U(       ak  [        R                  R'                  U5      (       d-  [        R                  " U5        [        R(                  " US5        [*        R,                  " XLS-   5        O9[        R                  R'                  U5      (       d  [*        R.                  " XSS9  U(       a  [*        R0                  " U5        gg! , (       d  f       GM  = f)zÜInstalls addon from a filepath, url or directory of addons in the
profile.

Args:
    addon: url, absolute path to .xpi, or directory of addons
    unpack: whether to unpack unless specified otherwise in the install.rdf
Nz.xpiÚ.éÿÿÿÿ)ÚsuffixÚrÚ/ÚwbÚidz!The addon id could not be found: Ú
extensionsÚunpackr   T)Úsymlinks)Úendswithr$   r%   r!   r"   Úsplitrp   rq   ÚnamelistÚisdirr#   Úmakedirsr-   Úreadr,   rK   Ú_addon_detailsÚgetr)   Úexistsr*   r&   r2   r'   Úrmtree)r5   Úaddonr›   ÚtmpdirÚxpifileÚcompressed_fileÚnameÚdatarN   Úaddon_detailsÚaddon_idÚextensions_dirÚ
addon_paths                r   rC   Ú!FirefoxProfile._install_extension±   sC  € ð ˆØˆØ�>‰>˜&×!Ò!Ü×%Ò%¨S´2·7±7·=±=ÀÓ3GÈÑ3KÑ-KÑLˆFÜ%Ÿošo¨e°SÓ9ˆOØ'×0Ñ0×2�Ø—=‘= ×%Ñ%ÜŸ7™7Ÿ=™=¬¯©¯©°fÓ)C×DÑDÜŸš¤B§G¡G§L¡L°Ó$>Ö?ñ Eô Ÿ7™7Ÿ=™=¬¯©¯©¼¿¹¿¹ÀfÓ9SÓ)T×UÑUÜŸš¤B§G¡G§O¡O´B·G±G·L±LÀÓ4NÓ$OÔPØ*×/Ñ/°Ó5�DÜœbŸg™gŸl™l¨6Ó8¸$Ô?À1ØŸ™ œ÷ @Ò?ñ 3ð ˆGØˆEð ×+Ñ+¨EÓ2ˆØ ×$Ñ$ TÓ*ˆÞÐDÐ<¸U¸GÐDÓDˆxô Ÿ™Ÿ™ d×&7Ñ&7¸ÓFˆÜ—W‘W—\‘\ .Ó;ˆ
Þ˜m¨H×5¾'Ü—7‘7—>‘> .×1Ñ1Ü—’˜NÔ+Ü—’˜¨Ô/Ü�KŠK˜¨fÑ!4Õ5ä—7‘7—>‘> *×-Ñ-Ü—’ ¸DÒAö Ü�MŠM˜&Õ!ð ÷/ @×?ús   Ç4M.Í.
M>	c                 óú  • SSSSS.nS nS nS n[         R                  R                  U5      (       d  [        SU 35      e [        R
                  " U5      (       af  [        R                  " US5       nS	UR                  5       ;   a   U" UR                  S	5      5      sSSS5        $ UR                  S
5      nSSS5        Oâ[         R                  R                  U5      (       a°  [         R                  R                  US	5      n[         R                  R                  U5      (       a*  [        USS9 n	U" U	R                  5       5      sSSS5        $ [        [         R                  R                  US
5      SS9 n	U	R                  5       nSSS5        O[        SU 35      e ["        R$                  " W5      nU" US5      nU" US5      nUR'                  US-   5      R)                  S5      nU(       d   UR'                  S5      R)                  S5      nUR*                   H@  nUR,                  R/                  US5      nUU;   d  M'  UR1                  UU" U5      05        MB     UR3                  S5      (       ds  [5        UR6                  R8                  5       HP  nUR6                  R)                  U5      nUR:                  US-   :X  d  M3  UR1                  SUR<                  05        MR     [A        US   [        5      (       a  US   RC                  5       S:H  US'   UR3                  S5      (       d  [        S5      eU$ ! , (       d  f       GN¯= f! , (       d  f       GN= f! , (       d  f       GNÓ= f! [        [        4 a0  n
[        [        U
5      [        R                   " 5       S   5      eSn
A
ff = f! [>         a0  n
[        [        U
5      [        R                   " 5       S   5      eSn
A
ff = f)aq  Returns a dictionary of details about the addon.

Args:
    addon_path: path to the add-on directory or XPI

Returns:
    A dictionary containing:

    {
        "id": "rainbow@colors.org",  # id of the addon
        "version": "1.4",  # version of the addon
        "name": "Rainbow",  # name of the addon
        "unpack": False,
    }  # whether to unpack the addon
NF)r™   r›   r«   Úversionc                 óT  • U R                   R                  nSn[        UR                  5       Hv  nUR	                  U5      R
                  U:X  d  M$  SUR	                  U5      R                  ;   d  ME  UR	                  U5      R                  R                  S5      S   S-   n  U$    U$ )NÚ Ú:rZ   )ÚdocumentElementÚ
attributesÚrangeÚlengthÚitemr:   r«   rž   )ÚdocÚurlr¸   Ú	namespaceÚis        r   Úget_namespace_idÚ7FirefoxProfile._addon_details.<locals>.get_namespace_idõ   s•   € Ø×,Ñ,×7Ñ7ˆJØˆIÜ˜:×,Ñ,Ö-�Ø—?‘? 1Ó%×+Ñ+¨sÕ2Ø˜jŸo™o¨aÓ0×5Ñ5Õ5à$.§O¡O°AÓ$6×$;Ñ$;×$AÑ$AÀ#Ó$FÀqÑ$IÈCÑ$O˜	ØØÐñ .ð Ðr   c                 óØ   • / nU R                    H:  nUR                  UR                  :X  d  M  UR                  UR                  5        M<     SR                  U5      R                  5       $ )z(Retrieve the text value of a given node.rµ   )Ú
childNodesÚnodeTypeÚ	TEXT_NODEÚappendr¬   r#   Ústrip)ÚelementÚrcÚnodes      r   Úget_textÚ/FirefoxProfile._addon_details.<locals>.get_text   sP   € àˆBØ×*Ô*�Ø—=‘= D§N¡NÕ2Ø—I‘I˜dŸi™iÖ(ñ +ð —7‘7˜2“;×$Ñ$Ó&Ð&r   c                 ó¼   • [         R                  " U 5      n US   S   S   nUUS   US   S	S
.$ ! [         a!    US   R                  SS5      S-   US   -   n N7f = f)zOExtracts the details from the contents of a WebExtensions
`manifest.json` file.ÚapplicationsÚgeckor™   r«   Ú rµ   Ú@r³   F)r™   r³   r«   r›   )r0   rˆ   ÚKeyErrorÚreplace)ÚcontentÚmanifestr™   s      r   Úparse_manifest_jsonÚ:FirefoxProfile._addon_details.<locals>.parse_manifest_json  s‡   € ô —z’z 'Ó*ˆHðSØ˜nÑ-¨gÑ6°tÑ<�ð Ø# IÑ.Ø  Ñ+Øñ	ð øô ó SØ˜fÑ%×-Ñ-¨c°2Ó6¸Ñ<¸xÈ	Ñ?RÑR’ðSús   ˜0 °(AÁAzAdd-on path does not exist: r–   zmanifest.jsonzinstall.rdfr   r   z/Add-on path is neither an XPI nor a directory: r„   z#http://www.mozilla.org/2004/em-rdf#z+http://www.w3.org/1999/02/22-rdf-syntax-ns#ÚDescriptionr   rµ   r™   r›   ÚtruezAdd-on id could not be found.)"r!   r"   r¥   ÚOSErrorrp   Ú
is_zipfilerq   rŸ   r¢   r    r#   r,   rÒ   r	   ÚstrÚsysÚexc_infor   ÚparseStringÚgetElementsByTagNamer»   rÃ   ÚnodeNamerÓ   Úupdater¤   r¹   r¸   rº   r«   r:   rŠ   r\   Úlower)r5   r°   ÚdetailsrÀ   rË   rÖ   rª   rÕ   Úmanifest_json_filenamerN   Úer¼   ÚemÚrdfÚdescriptionrÊ   Úentryr¿   Ú	attributes                      r   r£   ÚFirefoxProfile._addon_detailsá   sH  € ð$ ¨¸ÈÑNˆò		ò	'ò	ô �w‰w�~‰~˜j×)Ñ)ÜÐ8¸¸ÐEÓFÐFð	>Ü×!Ò! *×-Ñ-Ü—_’_ Z°Ô5¸Ø&¨/×*BÑ*BÓ*DÓDÙ2°?×3GÑ3GÈÓ3XÓY÷ 6Ñ5ð  /×3Ñ3°MÓB�H÷	 6Ð5ô
 —‘—‘˜z×*Ñ*Ü)+¯©¯©°jÀ/Ó)RÐ&Ü—7‘7—>‘>Ð"8×9Ñ9ÜÐ4¸wÒGÈ1Ù2°1·6±6³8Ó<÷ HÑGô œ"Ÿ'™'Ÿ,™, z°=ÓAÈGÒTÐXYØ Ÿv™v›x�H÷ UÐTô Ð OÐPZÈ|Ð\Ó]Ð]ð	>Ü×%Ò% hÓ/ˆCñ " #Ð'LÓMˆBÙ" 3Ð(UÓVˆCà×2Ñ2°3¸Ñ3FÓG×LÑLÈQÓOˆKÞØ!×6Ñ6°}ÓE×JÑJÈ1ÓM�Ø#×.Ô.�àŸ™×-Ñ-¨b°"Ó5�Ø˜GÕ#Ø—N‘N E©8°D«>Ð#:Ö;ñ	 /ð
 —;‘;˜t×$Ñ$Ü˜{×5Ñ5×<Ñ<Ö=�AØ +× 6Ñ 6× ;Ñ ;¸AÓ >�IØ —~‘~¨¨d©Õ2ØŸ™¨¨i¯o©oÐ'>Ö?ñ >ô �g˜hÑ'¬×-Ñ-Ø '¨Ñ 1× 7Ñ 7Ó 9¸VÑ CˆG�HÑð �{‰{˜4× Ñ Ü"Ð#BÓCÐCàˆ÷c 6Ö5ú÷ HÖGú÷ UÖTûô œÐ"ó 	>Ü"¤3 q£6¬3¯<ª<«>¸!Ñ+<Ó=Ð=ûð	>ûô. ó 	>Ü"¤3 q£6¬3¯<ª<«>¸!Ñ+<Ó=Ð=ûð	>ús±   Á2M= Á6+MÂ!	M= Â+MÂ<M= ÃA2M= Ä7MÅ	M= Å(M= Å?M+ÆM= ÆM= Æ(B!O  ÉBO  Ë!O  Í
MÍM= ÍM= Í
M(Í#M= Í+
M:Í5M= Í:M= Í=N=Î+N8Î8N=Ï 
O:Ï
+O5Ï5O:)r    rU   r)   rB   )rX   N)T)r   r   r   r   r+   r;   r?   r   rE   rO   Úpropertyr"   rV   Úsetterrb   rk   rÜ   r�   rJ   rC   r£   r   r   r   r   r   r   +   sŠ  † ØÐô7ò>/ñ ÐAÓBó+ó Cð+òGð ñ!ó ð!ð ÙÐ9Ó:ñó ;ó ðð 
‡[�[ÙÐ9Ó:óBó ;ó ðBð ÙÐJÓKñMó Ló ðMð ×"Ñ"ÙÐJÓKóGó Ló #ðGð
 ÙÐJÓKñNó Ló ðNð "×(Ñ(ÙÐJÓKóHó Ló )ðHð ð?˜ó ?ó ð?òñ ÐAÓBó-"ó Cð-"ñ^ ÐAÓBñkó Cókr   r   )ru   r2   r0   r!   r…   r&   rÝ   r$   r‹   rp   Úior   Úxml.domr   Útyping_extensionsr   Úselenium.common.exceptionsr   r/   rŠ   r	   r   r   r   r   Ú<module>ró      sd   ðó$ Û Û Û 	Û 	Û Û 
Û Û Û Ý Ý å (å 9à.Ð ñ Ð=Ó>ô?�yó ?ó ?ð?÷bò br   