
    g4                     0   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  G d d	ee          Z G d
 d          Z G d d          Z G d d          Z G d d          Z G d d          Z G d de          Z G d de          ZdS )    N)ABCMeta)abstractmethod)Enum)Optional)InvalidArgumentException)Proxyc                       e Zd ZdZdZdZdZdS )PageLoadStrategya  Enum of possible page load strategies.

    Selenium support following strategies:
        * normal (default) - waits for all resources to download
        * eager - DOM access is ready, but other resources like images may still be loading
        * none - does not block `WebDriver` at all

    Docs: https://www.selenium.dev/documentation/webdriver/drivers/options/#pageloadstrategy.
    normaleagernoneN)__name__
__module____qualname____doc__r   r   r        m/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/selenium/webdriver/common/options.pyr
   r
      s)          FEDDDr   r
   c                        e Zd Zd Zd Zd ZdS )_BaseOptionsDescriptorc                     || _         d S Nnameselfr   s     r   __init__z_BaseOptionsDescriptor.__init__-       			r   c                    | j         dk    r3|j                            d          }|du pt          |t                    S | j         dk    r8|j                            | j                   }t          |t                    sd n|S | j         dv r |j                            | j         d          S |j                            | j                   S )N
enableBidiwebSocketUrlT)acceptInsecureCertsstrictFileInteractabilitysetWindowRectse:downloadsEnabledF)r   _capsget
isinstancestr)r   objclsvalues       r   __get__z_BaseOptionsDescriptor.__get__0   s    9$$IMM.11ED=:Juc$:$::9&&IMM$),,E)%55@445@9ttt9==E222y}}TY'''r   c                     | j         dk    r|                    d|           d S |                    | j         |           d S )Nr    r!   )r   set_capabilityr   r*   r,   s      r   __set__z_BaseOptionsDescriptor.__set__=   sI    9$$~u55555ty%00000r   N)r   r   r   r   r-   r1   r   r   r   r   r   ,   sA          ( ( (1 1 1 1 1r   r   c                   $    e Zd ZdZd Zd Zd ZdS )_PageLoadStrategyDescriptorzDetermines 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
    c                     || _         d S r   r   r   s     r   r   z$_PageLoadStrategyDescriptor.__init__K   r   r   c                 @    |j                             | j                  S r   r&   r'   r   r   r*   r+   s      r   r-   z#_PageLoadStrategyDescriptor.__get__N       y}}TY'''r   c                 b    |dv r|                     | j        |           d S t          d          )N)r   r   r   z>Strategy can only be one of the following: normal, eager, noner/   r   
ValueErrorr0   s      r   r1   z#_PageLoadStrategyDescriptor.__set__Q   s;    ///ty%00000]^^^r   Nr   r   r   r   r   r-   r1   r   r   r   r3   r3   D   sP           ( ( (_ _ _ _ _r   r3   c                   $    e Zd ZdZd Zd Zd ZdS )"_UnHandledPromptBehaviorDescriptorad  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

    :returns: Values for implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)
    c                     || _         d S r   r   r   s     r   r   z+_UnHandledPromptBehaviorDescriptor.__init__b   r   r   c                 @    |j                             | j                  S r   r6   r7   s      r   r-   z*_UnHandledPromptBehaviorDescriptor.__get__e   r8   r   c                 b    |dv r|                     | j        |           d S t          d          )N)dismissacceptzdismiss and notifyzaccept and notifyignoreziBehavior can only be one of the following: dismiss, accept, dismiss and notify, accept and notify, ignorer:   r0   s      r   r1   z*_UnHandledPromptBehaviorDescriptor.__set__h   sC    ^^^ty%00000,  r   Nr<   r   r   r   r>   r>   X   sK           ( ( (    r   r>   c                   $    e Zd ZdZd Zd Zd ZdS )_TimeoutsDescriptoraL  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

    :returns: Values for implicit timeout, pageLoad timeout and script timeout if set (in milliseconds)
    c                     || _         d S r   r   r   s     r   r   z_TimeoutsDescriptor.__init__{   r   r   c                 @    |j                             | j                  S r   r6   r7   s      r   r-   z_TimeoutsDescriptor.__get__~   r8   r   c                     t          d |                                D                       r|                    | j        |           d S t	          d          )Nc              3      K   | ]}|d v V  	dS ))implicitpageLoadscriptNr   ).0xs     r   	<genexpr>z._TimeoutsDescriptor.__set__.<locals>.<genexpr>   s(      MM1q66MMMMMMr   zITimeout keys can only be one of the following: implicit, pageLoad, script)allkeysr/   r   r;   r0   s      r   r1   z_TimeoutsDescriptor.__set__   sW    MM

MMMMM 	jty%00000hiiir   Nr<   r   r   r   rF   rF   r   sP           ( ( (j j j j jr   rF   c                   $    e Zd ZdZd Zd Zd ZdS )_ProxyDescriptorz':Returns: Proxy if set, otherwise None.c                     || _         d S r   r   r   s     r   r   z_ProxyDescriptor.__init__   r   r   c                     |j         S r   )_proxyr7   s      r   r-   z_ProxyDescriptor.__get__   s
    zr   c                     t          |t                    st          d          ||_        |                                |j        | j        <   d S )Nz$Only Proxy objects can be passed in.)r(   r   r   rW   to_capabilitiesr&   r   r0   s      r   r1   z_ProxyDescriptor.__set__   sK    %'' 	S*+QRRR
$4466	$)r   Nr<   r   r   r   rT   rT      sG        11    7 7 7 7 7r   rT   c            	           e Zd ZdZ ed          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z		  ed          Z
	  ed          Z	  ed	          Z	  ed
          Z	  ed          Z	  ed          Z	  ed          Z	  ed          Z	 d fdZed             ZddZ	 	 	 ddee         dee         dee         ddfdZed             Zeed                         ZddZ xZ S )BaseOptionsz*Base class for individual browser options.browserVersionplatformNamer"   r#   r$   r    r!   pageLoadStrategyunhandledPromptBehaviortimeoutsproxyr%   returnNc                     t                                                       | j        | _        d | _        |                     dt          j                   d | _        d| _	        d S )Nr^   F)
superr   default_capabilitiesr&   rW   r/   r
   r   mobile_options_ignore_local_proxyr   	__class__s    r   r   zBaseOptions.__init__  s[    .
.0@0GHHH"#(   r   c                     | j         S r   r&   r   s    r   capabilitieszBaseOptions.capabilities  s
    zr   c                     || j         |<   dS )zSets a capability.Nrk   )r   r   r,   s      r   r/   zBaseOptions.set_capability  s     
4r   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)AttributeErrorrf   )r   ro   rp   rq   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                     dS )z-Convert options into capabilities dictionary.Nr   rl   s    r   rY   zBaseOptions.to_capabilities        r   c                     dS )z6Return minimal capabilities necessary as a dictionary.Nr   rl   s    r   re   z BaseOptions.default_capabilities  ry   r   c                     d| _         dS )aBy calling this you will ignore HTTP_PROXY and HTTPS_PROXY from
        being picked up and used.TN)rg   rl   s    r   (ignore_local_proxy_environment_variablesz4BaseOptions.ignore_local_proxy_environment_variables  s     $(   r   rb   N)NNN)!r   r   r   r   r   browser_versionplatform_nameaccept_insecure_certsstrict_file_interactabilityset_window_rectenable_bidiweb_socket_urlr3   page_load_strategyr>   unhandled_prompt_behaviorrF   r`   rT   ra   enable_downloadsr   propertyrm   r/   r   r)   rw   r   rY   re   r}   __classcell__ri   s   @r   r[   r[      s]       44,,-=>>O* +*>::M* 323HII* #9"89T"U"U* -,_==O* )(66K* ,+N;;N* 545GHH* !C BC\ ] ], #":..H, W%%E* .-.CDD* ,+N;;N*) ) ) ) ) )   X! ! ! ! *.*.'+	G G!#G #3-G  }	G
 
G G G G& < < ^< E E ^ XE( ( ( ( ( ( ( (r   r[   )	metaclassc                   n     e Zd ZdZdZd fdZed             ZddZd fdZ	d	 Z
ed
             Z xZS )
ArgOptionsz Binary Location Must be a Stringzfedcm:accountsrb   Nc                 V    t                                                       g | _        d S r   )rd   r   
_argumentsrh   s    r   r   zArgOptions.__init__  s$    r   c                     | j         S )z5:Returns: A list of arguments needed for the browser.)r   rl   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   appendr;   )r   arguments     r   add_argumentzArgOptions.add_argument  s7      	9O""8,,,,,7888r   c                     t          j        dt          d           t                                                       dS )r|   a  using ignore_local_proxy_environment_variables in Options has been deprecated, instead, create a Proxy instance with ProxyType.DIRECT to ignore proxy settings, pass the proxy instance into a ClientConfig constructor, pass the client config instance into the Webdriver constructor   )
stacklevelN)warningswarnDeprecationWarningrd   r}   rh   s    r   r}   z3ArgOptions.ignore_local_proxy_environment_variables  sJ     	M 	
 	
 	
 	
 	88:::::r   c                     | j         S r   rk   rl   s    r   rY   zArgOptions.to_capabilities  s
    zr   c                     i S r   r   rl   s    r   re   zArgOptions.default_capabilities  s    	r   r~   )r   r   r   BINARY_LOCATION_ERRORFEDCM_CAPABILITYr   r   r   r   r}   rY   re   r   r   s   @r   r   r     s        >'        X	9 	9 	9 	9; ; ; ; ; ;     X    r   r   )r   abcr   r   enumr   typingr   selenium.common.exceptionsr   selenium.webdriver.common.proxyr   r)   r
   r   r3   r>   rF   rT   r[   r   r   r   r   <module>r      s  $                          ? ? ? ? ? ? 1 1 1 1 1 1    sD    1 1 1 1 1 1 1 10_ _ _ _ _ _ _ _(       4j j j j j j j j,7 7 7 7 7 7 7 7 R( R( R( R( R(G R( R( R( R(j
, , , , , , , , , ,r   