
    Fth)                         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          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)InvalidArgumentException)Proxyc                        e Zd Zd Zd Zd ZdS )_BaseOptionsDescriptorc                     || _         d S Nnameselfr   s     u/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/selenium/webdriver/common/options.py__init__z_BaseOptionsDescriptor.__init__       			    c                     | j         dv r |j                            | j         d          S |j                            | j                   S )N)acceptInsecureCertsstrictFileInteractabilitysetWindowRectse:downloadsEnabledF)r   _capsgetr   objclss      r   __get__z_BaseOptionsDescriptor.__get__   s>    9ttt9==E222y}}TY'''r   c                 <    |                     | j        |           d S r
   )set_capabilityr   r   r   values      r   __set__z_BaseOptionsDescriptor.__set__"   s     49e,,,,,r   N)__name__
__module____qualname__r   r   r"    r   r   r   r      sA          ( ( (
- - - - -r   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__-   r   r   c                 @    |j                             | j                  S r
   r   r   r   r   s      r   r   z#_PageLoadStrategyDescriptor.__get__0       y}}TY'''r   c                 b    |dv r|                     | j        |           d S t          d          )N)normaleagernonez>Strategy can only be one of the following: normal, eager, noner   r   
ValueErrorr    s      r   r"   z#_PageLoadStrategyDescriptor.__set__3   s;    ///ty%00000]^^^r   Nr#   r$   r%   __doc__r   r   r"   r&   r   r   r(   r(   &   sP           ( ( (_ _ _ _ _r   r(   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__D   r   r   c                 @    |j                             | j                  S r
   r+   r   s      r   r   z*_UnHandledPromptBehaviorDescriptor.__get__G   r,   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, ignorer1   r    s      r   r"   z*_UnHandledPromptBehaviorDescriptor.__set__J   sC    ^^^ty%00000,  r   Nr3   r&   r   r   r6   r6   :   sK           ( ( (    r   r6   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
   r+   r   s      r   r   z_TimeoutsDescriptor.__get__`   r,   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>d   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   r2   r    s      r   r"   z_TimeoutsDescriptor.__set__c   sW    MM

MMMMM 	jty%00000hiiir   Nr3   r&   r   r   r>   r>   T   sP           ( ( (j j j j jr   r>   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__m   r   r   c                     |j         S r
   )_proxyr   s      r   r   z_ProxyDescriptor.__get__p   s
    zr   c                     t          |t                    st          d          ||_        |                                |j        | j        <   d S )Nz$Only Proxy objects can be passed in.)
isinstancer   r   rO   to_capabilitiesr   r   r    s      r   r"   z_ProxyDescriptor.__set__s   sK    %'' 	S*+QRRR
$4466	$)r   Nr3   r&   r   r   rL   rL   j   sG        11    7 7 7 7 7r   rL   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	 d fdZed             ZddZ	 	 	 ddej        e         dej        e         dej        e         ddfdZed             Zeed                         Z xZS )BaseOptionsz*Base class for individual browser options.browserVersionplatformNamer   r   r   pageLoadStrategyunhandledPromptBehaviortimeoutsproxyr   returnNc                     t                                                       | j        | _        d | _        |                     dd           d | _        d S )NrW   r.   )superr   default_capabilitiesr   rO   r   mobile_optionsr   	__class__s    r   r   zBaseOptions.__init__[  sO    .
.999"r   c                     | j         S r
   r   r   s    r   capabilitieszBaseOptions.capabilitiesb  s
    zr   c                     || j         |<   dS )zSets a capability.Nrc   )r   r   r!   s      r   r   zBaseOptions.set_capabilityf  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)AttributeErrorr_   )r   rg   rh   ri   s       r   enable_mobilezBaseOptions.enable_mobilej  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&   rd   s    r   rR   zBaseOptions.to_capabilities}        r   c                     dS )z6Return minimal capabilities necessary as a dictionary.Nr&   rd   s    r   r^   z BaseOptions.default_capabilities  rq   r   r[   N)NNN)r#   r$   r%   r4   r   browser_versionplatform_nameaccept_insecure_certsstrict_file_interactabilityset_window_rectr(   page_load_strategyr6   unhandled_prompt_behaviorr>   rY   rL   rZ   enable_downloadsr   propertyre   r   typingOptionalstrro   r   rR   r^   __classcell__ra   s   @r   rT   rT   z   s       44,,-=>>O* +*>::M* 323HII* #9"89T"U"U* -,_==O* 545GHH* !C BC\ ] ], #":..H, W%%E* .-.CDD*# # # # # #   X! ! ! ! 1515.2	G G-G !/#.G s+	G
 
G G G G& < < ^< E E ^ XE E E E Er   rT   )	metaclassc                   d     e Zd ZdZd
 fdZed             Zd Zd
dZd Z	ed	             Z
 xZS )
ArgOptionsz Binary Location Must be a Stringr[   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 )z5:Returns: A list of arguments needed for the browser.)r   rd   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   appendr2   )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   rd   s    r   (ignore_local_proxy_environment_variablesz3ArgOptions.ignore_local_proxy_environment_variables  s     $(   r   c                     | j         S r
   rc   rd   s    r   rR   zArgOptions.to_capabilities  s
    zr   c                     i S r
   r&   rd   s    r   r^   zArgOptions.default_capabilities  s    	r   rs   )r#   r$   r%   BINARY_LOCATION_ERRORr   r|   r   r   r   rR   r^   r   r   s   @r   r   r     s        >) ) ) ) ) )
   X	9 	9 	9( ( ( (
     X    r   r   )r}   abcr   r   selenium.common.exceptionsr   selenium.webdriver.common.proxyr   r   r(   r6   r>   rL   rT   r   r&   r   r   <module>r      s  "              ? ? ? ? ? ? 1 1 1 1 1 1
- 
- 
- 
- 
- 
- 
- 
-_ _ _ _ _ _ _ _(       4j j j j j j j j,7 7 7 7 7 7 7 7 JE JE JE JE JEG JE JE JE JEZ" " " " " " " " " "r   