
    8h)                         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y)    N)ABCMeta)abstractmethod)InvalidArgumentException)Proxyc                       e Zd Zd Zd Zd Zy)_BaseOptionsDescriptorc                     || _         y Nnameselfr   s     x/home/stella.sw7ft.com/public_html/site_rebuilder/venv/lib/python3.12/site-packages/selenium/webdriver/common/options.py__init__z_BaseOptionsDescriptor.__init__   	    	    c                     | j                   dv r&|j                  j                  | j                   d      S |j                  j                  | j                         S )N)acceptInsecureCertsstrictFileInteractabilitysetWindowRectse:downloadsEnabledF)r   _capsgetr   objclss      r   __get__z_BaseOptionsDescriptor.__get__   s?    99tt99==E22yy}}TYY''r   c                 <    |j                  | j                  |       y r
   )set_capabilityr   r   r   values      r   __set__z_BaseOptionsDescriptor.__set__"   s    499e,r   N)__name__
__module____qualname__r   r   r"    r   r   r   r      s    (
-r   r   c                   "    e Zd ZdZd Zd Zd Zy)_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                     || _         y r
   r   r   s     r   r   z$_PageLoadStrategyDescriptor.__init__-   r   r   c                 L    |j                   j                  | j                        S r
   r   r   r   r   s      r   r   z#_PageLoadStrategyDescriptor.__get__0       yy}}TYY''r   c                 Z    |dv r|j                  | j                  |       y 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+    //tyy%0]^^r   Nr#   r$   r%   __doc__r   r   r"   r&   r   r   r(   r(   &   s    (_r   r(   c                   "    e Zd ZdZd Zd Zd Zy)"_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                     || _         y r
   r   r   s     r   r   z+_UnHandledPromptBehaviorDescriptor.__init__D   r   r   c                 L    |j                   j                  | j                        S r
   r+   r   s      r   r   z*_UnHandledPromptBehaviorDescriptor.__get__G   r,   r   c                 Z    |dv r|j                  | j                  |       y 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   s1    ^^tyy%0, r   Nr3   r&   r   r   r6   r6   :   s    (r   r6   c                   "    e Zd ZdZd Zd Zd Zy)_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                     || _         y r
   r   r   s     r   r   z_TimeoutsDescriptor.__init__]   r   r   c                 L    |j                   j                  | j                        S r
   r+   r   s      r   r   z_TimeoutsDescriptor.__get__`   r,   r   c                     t        d |j                         D              r|j                  | j                  |       y t	        d      )Nc              3   $   K   | ]  }|d v  
 yw))implicitpageLoadscriptNr&   ).0xs     r   	<genexpr>z._TimeoutsDescriptor.__set__.<locals>.<genexpr>d   s     M1q66Ms   zITimeout keys can only be one of the following: implicit, pageLoad, script)allkeysr   r   r2   r    s      r   r"   z_TimeoutsDescriptor.__set__c   s6    M

MMtyy%0hiir   Nr3   r&   r   r   r>   r>   T   s    (jr   r>   c                   "    e Zd ZdZd Zd Zd Zy)_ProxyDescriptorz':Returns: Proxy if set, otherwise None.c                     || _         y 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    zzr   c                     t        |t              st        d      ||_        |j	                         |j
                  | j                  <   y )Nz$Only Proxy objects can be passed in.)
isinstancer   r   rO   to_capabilitiesr   r   r    s      r   r"   z_ProxyDescriptor.__set__s   s:    %'*+QRR
$446		$))r   Nr3   r&   r   r   rL   rL   j   s    1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j0                  e   dej0                  e   dej0                  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 | _        | j                  dd       d | _        y )NrW   r.   )superr   default_capabilitiesr   rO   r   mobile_optionsr   	__class__s    r   r   zBaseOptions.__init__[  s;    ..
.9"r   c                     | j                   S r
   r   r   s    r   capabilitieszBaseOptions.capabilitiesb  s    zzr   c                 "    || j                   |<   y)zSets a capability.Nrc   )r   r   r!   s      r   r   zBaseOptions.set_capabilityf  s     

4r   android_packageandroid_activitydevice_serialc                 v    |st        d      d|i| _        |r|| j                  d<   |r|| j                  d<   yy)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  sM      !DEE/A5ED 129FD 56 r   c                      y)z-Convert options into capabilities dictionary.Nr&   rd   s    r   rR   zBaseOptions.to_capabilities}      r   c                      y)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,-=>O* +>:M* 33HI* #99T"U* -_=O* 55GH* !CC\ ], #:.H, W%E* ..CD*#  ! 1515.2	G-G !//#.G s+	G
 
G& < < E  Er   rT   )	metaclassc                   X     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 Stringc                 >    t         |           g | _        d| _        y )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                 T    |r| j                   j                  |       y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  s%     OO""8,788r   c                     d| _         y)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    zz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     sE    >)
  	9(
  r   r   )r}   abcr   r   selenium.common.exceptionsr   selenium.webdriver.common.proxyr   r   r(   r6   r>   rL   rT   r   r&   r   r   <module>r      si   "    ? 1
- 
-_ _( 4j j,7 7 JEG JEZ" "r   