
    hgy#                     t    d dl mZ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 )    )ABCMetaabstractmethod)NoReturn)Proxy)InvalidArgumentExceptionc                       e Zd ZdZ fdZed             Zd Zedefd            Z	e	j
        dedefd            Z	edefd	            Zej
        d
edefd            Zedefd            Zej
        dedefd            Zedefd            Zej
        dedefd            Zedefd            Zej
        dedefd            Zd%dededefdZedefd            Zej
        dedefd            Zedefd            Zej
        defd            Zedefd            Zej
        defd             Zedefd!            Zej
        defd"            Zed#             Zeed$                         Z xZS )&BaseOptionsz3
    Base class for individual browser options
    c                     t          t          |                                            | j        | _        |                     dd           d | _        d S )NpageLoadStrategynormal)superr	   __init__default_capabilities_capsset_capabilitymobile_optionsself	__class__s    Z/var/www/fb-scrape/myenv/lib/python3.11/site-packages/selenium/webdriver/common/options.pyr   zBaseOptions.__init__   sN    k4  ))+++.
.999"    c                     | j         S Nr   r   s    r   capabilitieszBaseOptions.capabilities#   s
    zr   c                     || j         |<   dS )z Sets a capability Nr   )r   namevalues      r   r   zBaseOptions.set_capability'   s     
4r   returnc                     | j         d         S )zN
        :returns: the version of the browser if set, otherwise None.
        browserVersionr   r   s    r   browser_versionzBaseOptions.browser_version+   s    
 z*++r   versionc                 2    |                      d|           dS )z
        Requires the major version of the browser to match provided value:
        https://w3c.github.io/webdriver/#dfn-browser-version

        :param version: The required version of the browser
        r"   Nr   )r   r$   s     r   r#   zBaseOptions.browser_version2   s!     	,g66666r   c                     | j         d         S )z4
        :returns: The name of the platform
        platformNamer   r   s    r   platform_namezBaseOptions.platform_name<   s    
 z.))r   platformc                 2    |                      d|           dS )z
        Requires the platform to match the provided value: https://w3c.github.io/webdriver/#dfn-platform-name

        :param platform: the required name of the platform
        r(   Nr&   )r   r*   s     r   r)   zBaseOptions.platform_nameC   s      	NH55555r   c                     | j         d         S )zN
        :returns: page load strategy if set, the default is "normal"
        r   r   r   s    r   page_load_strategyzBaseOptions.page_load_strategyL   s    
 z,--r   strategyc                 X    |dv r|                      d|           dS t          d          )z
        Determines the point at which a navigation command is returned:
        https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies

        :param strategy: the strategy corresponding to a document readiness state
        )r   eagernoner   z>Strategy can only be one of the following: normal, eager, noneNr   
ValueError)r   r.   s     r   r-   zBaseOptions.page_load_strategyS   s<     222 2H=====]^^^r   c                     | j         d         S )za
        :returns: unhandled prompt behavior if set, the default is "dismiss and notify"
        unhandledPromptBehaviorr   r   s    r   unhandled_prompt_behaviorz%BaseOptions.unhandled_prompt_behavior`   s    
 z344r   behaviorc                 X    |dv r|                      d|           dS t          d          )a
  
        How the driver should respond when an alert is present and the command sent is not handling the alert:
        https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies

        :param behavior: behavior to use when an alert is encountered
        )dismissacceptzdismiss and notifyzaccept and notifyignorer5   ziBehavior can only be one of the following: dismiss, accept, dismiss and notify, accept and notify, ignoreNr2   )r   r7   s     r   r6   z%BaseOptions.unhandled_prompt_behaviorg   sD     aaa 98DDDDD 9 : : :r   c                     | j         d         S )zu
        :returns: Values for implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)
        timeoutsr   r   s    r   r=   zBaseOptions.timeoutsu   s    
 z*%%r   r=   c                     t          fddD                       r|                     d           dS t          d          )z
        How long the driver should wait for actions to complete before returning an error
        https://w3c.github.io/webdriver/#timeouts

        :param timeouts: values in milliseconds for implicit wait, page load and script timeout
        c              3   D   K   | ]}|                                 v V  d S r   )keys).0xr=   s     r   	<genexpr>z'BaseOptions.timeouts.<locals>.<genexpr>   s0      PPqHMMOO#PPPPPPr   )implicitpageLoadscriptr=   zITimeout keys can only be one of the following: implicit, pageLoad, scriptN)allr   r3   )r   r=   s    `r   r=   zBaseOptions.timeouts|   sW     PPPP-OPPPPP 	j
H55555hiiir   Nandroid_packageandroid_activitydevice_serialc                 n    |st          d          d|i| _        |r
|| j        d<   |r|| j        d<   dS dS )z
            Enables mobile browser use for browsers that support it

            :Args:
                android_activity: The name of the android package to start
        z!android_package must be passed inandroidPackageandroidActivityandroidDeviceSerialN)AttributeErrorr   )r   rH   rI   rJ   s       r   enable_mobilezBaseOptions.enable_mobile   sm      	F !DEEEo
  	F5ED 12 	G9FD 5666	G 	Gr   c                 6    | j                             d          S )zM
        :returns: whether the session accepts insecure certificates
        acceptInsecureCertsr   getr   s    r   accept_insecure_certsz!BaseOptions.accept_insecure_certs   s    
 z~~3444r   r   c                     || j         d<   dS )z
        Whether untrusted and self-signed TLS certificates are implicitly trusted:
        https://w3c.github.io/webdriver/#dfn-insecure-tls-certificates

        :param value: whether to accept insecure certificates
        rR   Nr   r   r   s     r   rU   z!BaseOptions.accept_insecure_certs   s     -2
()))r   c                 6    | j                             d          S )zP
        :returns: whether session is strict about file interactability
        strictFileInteractabilityrS   r   s    r   strict_file_interactabilityz'BaseOptions.strict_file_interactability   s    
 z~~9:::r   c                     || j         d<   dS )z
        Whether interactability checks will be applied to file type input elements. The default is false.

        :param value: whether file interactability is strict
        rY   Nr   rW   s     r   rZ   z'BaseOptions.strict_file_interactability   s     38
.///r   c                 6    | j                             d          S )z\
        :returns: whether the remote end supports setting window size and position
        setWindowRectrS   r   s    r   set_window_rectzBaseOptions.set_window_rect   s    
 z~~o...r   c                     || j         d<   dS )a  
        Whether the remote end supports all of the resizing and positioning commands. The default is false.
        https://w3c.github.io/webdriver/#dfn-strict-file-interactability

        :param value: whether remote end must support setting window resizing and repositioning
        r]   Nr   rW   s     r   r^   zBaseOptions.set_window_rect   s     ',
?###r   c                     | j         S )z9
        :Returns: Proxy if set, otherwise None.
        )_proxyr   s    r   proxyzBaseOptions.proxy   s    
 {r   c                 \    t          |t                    st          d          || _        d S )Nz$Only Proxy objects can be passed in.)
isinstancer   r   ra   rW   s     r   rb   zBaseOptions.proxy   s/    %'' 	S*+QRRRr   c                     dS )z-Convert options into capabilities dictionary.N r   s    r   to_capabilitieszBaseOptions.to_capabilities         r   c                     dS )z6Return minimal capabilities necessary as a dictionary.Nrf   r   s    r   r   z BaseOptions.default_capabilities   rh   r   )NNN)__name__
__module____qualname____doc__r   propertyr   r   strr#   setterr   r)   r-   r6   dictr=   rP   boolrU   rZ   r^   r   rb   r   rg   r   __classcell__r   s   @r   r	   r	      s        # # # # #   X! ! ! , , , , X, 7s 7x 7 7 7 7 *s * * * X* 6c 6h 6 6 6 6 .C . . . X. 
_3 
_8 
_ 
_ 
_ 
_ 53 5 5 5 X5 %:# :( : : : &%: &$ & & & X& _
j 
j( 
j 
j 
j _
jG GS G3 Gfi G G G G" 5t 5 5 5 X5 !24 2H 2 2 2 "!2 ;T ; ; ; X; !'8 8 8 8 ('8 / / / / X/ ,T , , , , u    X \5    \
 < < ^< E E ^ XE E E E Er   r	   )	metaclassc                   \     e Zd Z fdZed             Zd Zd Zd Zed             Z	 xZ
S )
ArgOptionsc                 r    t          t          |                                            g | _        d| _        d S )NF)r   rw   r   
_arguments_ignore_local_proxyr   s    r   r   zArgOptions.__init__   s4    j$((***#(   r   c                     | j         S )zF
        :Returns: A list of arguments needed for the browser
        )ry   r   s    r   	argumentszArgOptions.arguments   s    
 r   c                 \    |r| j                             |           dS t          d          )z\
        Adds an argument to the list

        :Args:
         - Sets the arguments
        zargument can not be nullN)ry   appendr3   )r   arguments     r   add_argumentzArgOptions.add_argument   s7      	9O""8,,,,,7888r   c                     d| _         dS )zo
            By calling this you will ignore HTTP_PROXY and HTTPS_PROXY from being picked up and used.
        TN)rz   r   s    r   (ignore_local_proxy_environment_variablesz3ArgOptions.ignore_local_proxy_environment_variables   s     $(   r   c                     | j         S r   r   r   s    r   rg   zArgOptions.to_capabilities  s
    zr   c                     i S r   rf   r   s    r   r   zArgOptions.default_capabilities  s    	r   )rj   rk   rl   r   rn   r|   r   r   rg   r   rs   rt   s   @r   rw   rw      s        ) ) ) ) )
   X
9 
9 
9( ( (     X    r   rw   N)abcr   r   typingr   selenium.webdriver.common.proxyr   selenium.common.exceptionsr   r	   rw   rf   r   r   <module>r      s   $ ( ' ' ' ' ' ' '       1 1 1 1 1 1 ? ? ? ? ? ?HE HE HE HE HEG HE HE HE HEV% % % % % % % % % %r   