
    hg                         d dl m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
  G d de          Z G d	 d
e
          ZdS )    )UnionN)DesiredCapabilities)FirefoxBinary)FirefoxProfile)
ArgOptionsc                        e Zd Zd ZdefdZdS )Logc                     d | _         d S Nlevelselfs    [/var/www/fb-scrape/myenv/lib/python3.11/site-packages/selenium/webdriver/firefox/options.py__init__zLog.__init__   s    


    returnc                 *    | j         rdd| j         iiS i S )Nlogr   r   r   s    r   to_capabilitieszLog.to_capabilities   s#    : 	2GTZ011	r   N)__name__
__module____qualname__r   dictr    r   r   r	   r	      s>                r   r	   c                       e Zd ZdZ fdZedefd            Zej        de	e
ef         fd            Zede
fd            Zej        de
fd	            Zedefd
            Zde
de	e
eef         fdZedefd            Zej        de	e
ef         fd            Zedefd            Zej        defd            Zdde
f fdZdefdZedefd            Z xZS )Optionszmoz:firefoxOptionsc                     t          t          |                                            d | _        i | _        d | _        d | _        t                      | _        d S r   )	superr   r   _binary_preferences_profile_proxyr	   r   )r   	__class__s    r   r   zOptions.__init__&   sK    gt%%'''&*"$55r   r   c                     | j         S )z"Returns the FirefoxBinary instance)r    r   s    r   binaryzOptions.binary.   s     |r   
new_binaryc                 \    t          |t                    st          |          }|| _        dS )zfSets location of the browser binary, either by string or
        ``FirefoxBinary`` instance.

        N)
isinstancer   r    )r   r'   s     r   r&   zOptions.binary3   s.     *m44 	3&z22J!r   c                     | j         j        S )z7
        :Returns: The location of the binary.
        )r&   
_start_cmdr   s    r   binary_locationzOptions.binary_location=   s    
 {%%r   valuec                     || _         dS )z3 Sets the location of the browser binary by string N)r&   r   r-   s     r   r,   zOptions.binary_locationD   s     r   c                     | j         S )z :Returns: A dict of preferences.r!   r   s    r   preferenceszOptions.preferencesI   s       r   namec                     || j         |<   dS )zSets a preference.Nr1   )r   r3   r-   s      r   set_preferencezOptions.set_preferenceN   s    "'$r   c                 V    | j         rt          j        dt          d           | j         S )z7
        :Returns: The Firefox profile to use.
        z&Getting a profile has been deprecated.   
stacklevel)r"   warningswarnDeprecationWarningr   s    r   profilezOptions.profileR   s:    
 = 	M8"   
 }r   new_profilec                     t          j        dt          d           t          |t                    st	          |          }|| _        dS )zfSets location of the browser profile to use, either by string
        or ``FirefoxProfile``.

        z_Setting a profile has been deprecated. Please use the set_preference and install_addons methodsr7   r8   N)r:   r;   r<   r)   r   r"   )r   r>   s     r   r=   zOptions.profile_   sR     	m	
 	
 	
 	

 +~66 	6(55K#r   c                     d| j         v S )zL
        :Returns: True if the headless argument is set, else False
        	-headless)
_argumentsr   s    r   headlesszOptions.headlessn   s    
 do--r   c                     |r| j                             d           dS d| j         v r| j                             d           dS dS )z
        Sets the headless argument

        Args:
          value: boolean value indicating to set the headless option
        rA   N)rB   appendremover/   s     r   rC   zOptions.headlessu   sY      	0O"";/////DO++O"";///// ,+r   org.mozilla.firefoxNandroid_packagec                 N    t                                          |||           d S r   )r   enable_mobile)r   rH   android_activitydevice_serialr$   s       r   rJ   zOptions.enable_mobile   s&    o/?OOOOOr   c                    | j         }i }| j        r| j        j        |d<   | j        r
| j        |d<   | j        r| j                            |           | j        r| j        j        |d<   | j        r
| j        |d<   | j	        r|
                    | j	                   |
                    | j                                                   |r||t          j        <   |S )zOMarshals the Firefox options to a `moz:firefoxOptions`
        object.
        r&   prefsr=   args)_capsr    r+   r!   r#   add_to_capabilitiesr"   encodedrB   mobile_optionsupdater   r   r   KEY)r   capsoptss      r   r   zOptions.to_capabilities   s     z< 	5!\4DN 	. -DM; 	2K++D111= 	4"m3DO? 	+?DL 	-KK+,,,DH,,../// 	% $Dr   c                 >    t           j                                        S r   )r   FIREFOXcopyr   s    r   default_capabilitieszOptions.default_capabilities   s    "*//111r   )rG   NN)r   r   r   rU   r   propertyr   r&   setterr   strr,   r   r2   intboolr5   r   r=   rC   rJ   r   r[   __classcell__)r$   s   @r   r   r   #   s[       
C         X ]"sM'9!: " " " ]" & & & & X& S     !T ! ! ! X!(3 (uS#t^/D ( ( ( ( 
 
 
 
 X
 ^$5n)<#= $ $ $ ^$ .$ . . . X. _
0d 
0 
0 
0 _
0P PS P P P P P P    > 2d 2 2 2 X2 2 2 2 2r   r   )typingr   r:   .selenium.webdriver.common.desired_capabilitiesr   )selenium.webdriver.firefox.firefox_binaryr   *selenium.webdriver.firefox.firefox_profiler   !selenium.webdriver.common.optionsr   objectr	   r   r   r   r   <module>rh      s   "        N N N N N N C C C C C C E E E E E E 8 8 8 8 8 8    &   C2 C2 C2 C2 C2j C2 C2 C2 C2 C2r   