
    Eg#                     x    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 )    N)ABCMeta)abstractmethod)InvalidArgumentException)Proxyc            	       V    e Zd ZdZd% fdZed             Zd%dZedefd            Z	e	j
        deddfd	            Z	edefd
            Zej
        deddfd            Zedefd            Zej
        deddfd            Zedefd            Zej
        deddfd            Zedefd            Zej
        deddfd            Z	 	 	 d&dej        e         dej        e         dej        e         ddfdZedefd            Zej
        deddfd            Zedefd            Zej
        deddfd            Zedefd            Zej
        deddfd             Zedefd!            Zej
        deddfd"            Zed#             Zeed$                         Z xZS )'BaseOptionsz*Base class for individual browser options.returnNc                     t                                                       | j        | _        |                     dd           d | _        d S )NpageLoadStrategynormal)super__init__default_capabilities_capsset_capabilitymobile_optionsself	__class__s    V/var/www/sysmax/venv/lib/python3.11/site-packages/selenium/webdriver/common/options.pyr   zBaseOptions.__init__   sH    .
.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   c                 6    | j                             d          S )zN
        :returns: the version of the browser if set, otherwise None.
        browserVersionr   getr   s    r   browser_versionzBaseOptions.browser_version*   s    
 z~~.///r   versionc                 2    |                      d|           dS )zRequires 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_version1   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 )zRequires 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_nameA   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_strategyJ   s    
 z,--r   strategyc                 X    |dv r|                      d|           dS t          d          )zDetermines 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_strategyQ   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ignorer6   ziBehavior can only be one of the following: dismiss, accept, dismiss and notify, accept and notify, ignoreNr3   )r   r8   s     r   r7   z%BaseOptions.unhandled_prompt_behaviord   sD     aaa 98DDDDD,  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.timeoutst   s    
 z*%%r   r>   c                     t          d |                                D                       r|                     d|           dS t          d          )zHow 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      K   | ]}|d v V  	dS ))implicitpageLoadscriptN ).0xs     r   	<genexpr>z'BaseOptions.timeouts.<locals>.<genexpr>   s(      PP1q66PPPPPPr   r>   zITimeout keys can only be one of the following: implicit, pageLoad, scriptN)allkeysr   r4   )r   r>   s     r   r>   zBaseOptions.timeouts{   sW     PPPPPPP 	j
H55555hiiir   android_packageandroid_activitydevice_serialc                 n    |st          d          d|i| _        |r
|| j        d<   |r|| j        d<   dS dS )zEnables 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   rJ   rK   rL   s       r   enable_mobilezBaseOptions.enable_mobile   si      	F !DEEE/A 	F5ED 12 	G9FD 5666	G 	Gr   c                 8    | j                             dd          S )zM
        :returns: whether the session accepts insecure certificates
        acceptInsecureCertsFr"   r   s    r   accept_insecure_certsz!BaseOptions.accept_insecure_certs   s    
 z~~3U;;;r   r   c                     || j         d<   dS )zWhether 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
        rT   Nr   r   r   s     r   rU   z!BaseOptions.accept_insecure_certs   s     -2
()))r   c                 8    | j                             dd          S )zP
        :returns: whether session is strict about file interactability
        strictFileInteractabilityFr"   r   s    r   strict_file_interactabilityz'BaseOptions.strict_file_interactability   s    
 z~~95AAAr   c                     || j         d<   dS )zWhether 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                 8    | j                             dd          S )z\
        :returns: whether the remote end supports setting window size and position
        setWindowRectFr"   r   s    r   set_window_rectzBaseOptions.set_window_rect   s    
 z~~ou555r   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.NrD   r   s    r   to_capabilitieszBaseOptions.to_capabilities         r   c                     dS )z6Return minimal capabilities necessary as a dictionary.NrD   r   s    r   r   z BaseOptions.default_capabilities   rg   r   r	   N)NNN)__name__
__module____qualname____doc__r   propertyr   r   strr$   setterr*   r.   r7   dictr>   typingOptionalrR   boolrU   rZ   r^   r   rb   r   rf   r   __classcell__r   s   @r   r   r      sO       44# # # # # #   X! ! ! ! 0 0 0 0 X0 7s 7t 7 7 7 7 *s * * * X* 6c 6d 6 6 6 6 .C . . . X. 	_3 	_4 	_ 	_ 	_ 	_ 53 5 5 5 X5 %# $    &% &$ & & & X& _	j 	j$ 	j 	j 	j _	j 1515.2	G G-G !/#.G s+	G
 
G G G G& <t < < < X< !24 2D 2 2 2 "!2 BT B B B XB !'8 8$ 8 8 8 ('8 6 6 6 6 X6 ,T ,d , , , , u    X \5 T    \
 < < ^< E E ^ XE E E E Er   r   )	metaclassc                   `     e Zd Zd	 fdZed             Zd Zd	dZd Zed             Z	 xZ
S )

ArgOptionsr	   Nc                 d    t                                                       g | _        d| _        d S )NF)r   r   
_arguments_ignore_local_proxyr   s    r   r   zArgOptions.__init__   s.    #(   r   c                     | j         S )zF
        :Returns: A list of arguments needed for the browser
        )r{   r   s    r   	argumentszArgOptions.arguments   s    
 r   c                 \    |r| j                             |           dS t          d          )zTAdds an argument to the list.

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