
    ,h>3                         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y)    N)ABCMeta)abstractmethod)Enum)Optional)InvalidArgumentException)Proxyc                       e Zd ZdZdZdZdZy)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        c/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/selenium/webdriver/common/options.pyr
   r
      s     FEDr   r
   c                       e Zd Zd Zd Zd Zy)_BaseOptionsDescriptorc                     || _         y Nnameselfr   s     r   __init__z_BaseOptionsDescriptor.__init__-   	    	r   c                    | j                   dk(  r1|j                  j                  d      }|du xs t        |t              S | j                   dk(  r9|j                  j                  | j                         }t        |t              sd S |S | j                   dv r&|j                  j                  | j                   d      S |j                  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    99$IIMM.1ED=:Juc$::99&IIMM$)),E)%54@5@99tt99==E22yy}}TYY''r   c                     | j                   dk(  r|j                  d|       y |j                  | j                   |       y )Nr    r!   )r   set_capabilityr   r*   r,   s      r   __set__z_BaseOptionsDescriptor.__set__=   s2    99$~u5tyy%0r   N)r   r   r   r   r-   r1   r   r   r   r   r   ,   s    (1r   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__K   r   r   c                 L    |j                   j                  | j                        S r   r&   r'   r   r   r*   r+   s      r   r-   z#_PageLoadStrategyDescriptor.__get__N       yy}}TYY''r   c                 Z    |dv r|j                  | j                  |       y 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+    //tyy%0]^^r   Nr   r   r   r   r   r-   r1   r   r   r   r3   r3   D   s    (_r   r3   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__b   r   r   c                 L    |j                   j                  | j                        S r   r6   r7   s      r   r-   z*_UnHandledPromptBehaviorDescriptor.__get__e   r8   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, ignorer:   r0   s      r   r1   z*_UnHandledPromptBehaviorDescriptor.__set__h   s1    ^^tyy%0, r   Nr<   r   r   r   r>   r>   X   s    (r   r>   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   r6   r7   s      r   r-   z_TimeoutsDescriptor.__get__~   r8   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>   s     M1q66Ms   zITimeout keys can only be one of the following: implicit, pageLoad, script)allkeysr/   r   r;   r0   s      r   r1   z_TimeoutsDescriptor.__set__   s6    M

MMtyy%0hiir   Nr<   r   r   r   rF   rF   r   s    (jr   rF   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__   r   r   c                     |j                   S r   )_proxyr7   s      r   r-   z_ProxyDescriptor.__get__   s    zzr   c                     t        |t              st        d      ||_        |j	                         |j
                  | j                  <   y )Nz$Only Proxy objects can be passed in.)r(   r   r   rW   to_capabilitiesr&   r   r0   s      r   r1   z_ProxyDescriptor.__set__   s:    %'*+QRR
$446		$))r   Nr<   r   r   r   rT   rT      s    17r   rT   c            	       x    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	 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    pageLoadStrategyunhandledPromptBehaviortimeoutsproxyr%   r!   returnNc                     t         |           | j                  | _        d | _        | j                  dt        j                         d | _        d| _	        y )Nr^   F)
superr   default_capabilitiesr&   rW   r/   r
   r   mobile_options_ignore_local_proxyr   	__class__s    r   r   zBaseOptions.__init__  sJ    ..
.0@0G0GH"#( r   c                     | j                   S r   r&   r   s    r   capabilitieszBaseOptions.capabilities  s    zzr   c                 "    || j                   |<   y)zSets a capability.Nrk   )r   r   r,   s      r   r/   zBaseOptions.set_capability  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)AttributeErrorrf   )r   ro   rp   rq   s       r   enable_mobilezBaseOptions.enable_mobile  sM      !DEE/A5ED 129FD 56 r   c                      y)z-Convert options into capabilities dictionary.Nr   rl   s    r   rY   zBaseOptions.to_capabilities      r   c                      y)z6Return minimal capabilities necessary as a dictionary.Nr   rl   s    r   re   z BaseOptions.default_capabilities  ry   r   c                     d| _         y)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_bidir3   page_load_strategyr>   unhandled_prompt_behaviorrF   r`   rT   ra   enable_downloadsweb_socket_urlr   propertyrm   r/   r   r)   rw   r   rY   re   r}   __classcell__ri   s   @r   r[   r[      sx   4,-=>O* +>:M* 33HI* #99T"U* -_=O* )6K* 55GH* !CC\ ], #:.H, W%E* ..CD* ,N;N*)  ! *.*.'+	G!#G #3-G  }	G
 
G& < < E  E(r   r[   )	metaclassc                   b     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:accountsc                 0    t         |           g | _        y 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                 T    |r| j                   j                  |       y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  s%     OO""8,788r   c                 Z    t        j                  dt        d       t        |           y)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  s,     	M 	
 	8:r   c                     | j                   S r   rk   rl   s    r   rY   zArgOptions.to_capabilities  s    zz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     sK    >'  	9;  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sD  1 10_ _( 4j j,7 7 |(G |(~	, ,r   