
    vKg4                         S SK r S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SK	J
r
   " S S\\5      r " S	 S
5      r " S S5      r " S S5      r " S S5      r " S S5      r " S S\S9r " S S\5      rg)    N)ABCMeta)abstractmethod)Enum)InvalidArgumentException)Proxyc                   $    \ rS rSrSrSrSrSrSrg)PageLoadStrategy   an  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none N)	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__r       a/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/selenium/webdriver/common/options.pyr	   r	      s     FEDr   r	   c                   &    \ rS rSrS rS rS rSrg)_BaseOptionsDescriptor+   c                     Xl         g Nnameselfr   s     r   __init___BaseOptionsDescriptor.__init__,       	r   c                    U R                   S:X  a6  UR                  R                  S5      nUSL =(       d    [        U[        5      $ U R                   S:X  a>  UR                  R                  U R                   5      n[        U[        5      (       d  S $ U$ U R                   S;   a&  UR                  R                  U R                   S5      $ UR                  R                  U R                   5      $ )N
enableBidiwebSocketUrlT)acceptInsecureCertsstrictFileInteractabilitysetWindowRectse:downloadsEnabledF)r   _capsget
isinstancestr)r   objclsvalues       r   __get___BaseOptionsDescriptor.__get__/   s    99$IIMM.1ED=:Juc$::99&IIMM$)),E)%554@5@99tt99==E22yy}}TYY''r   c                     U R                   S:X  a  UR                  SU5        g UR                  U R                   U5        g )Nr$   r%   )r   set_capabilityr   r.   r0   s      r   __set___BaseOptionsDescriptor.__set__<   s2    99$~u5tyy%0r   r   N)r   r   r   r   r    r1   r6   r   r   r   r   r   r   +   s    (1r   r   c                   *    \ rS rSrSrS rS rS rSrg)_PageLoadStrategyDescriptorC   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
c                     Xl         g r   r   r   s     r   r    $_PageLoadStrategyDescriptor.__init__J   r"   r   c                 L    UR                   R                  U R                  5      $ r   r*   r+   r   r   r.   r/   s      r   r1   #_PageLoadStrategyDescriptor.__get__M       yy}}TYY''r   c                 ^    US;   a  UR                  U R                  U5        g [        S5      e)N)r   r   r   z>Strategy can only be one of the following: normal, eager, noner4   r   
ValueErrorr5   s      r   r6   #_PageLoadStrategyDescriptor.__set__P   s+    //tyy%0]^^r   r   N	r   r   r   r   r   r    r1   r6   r   r   r   r   r9   r9   C   s    (_r   r9   c                   *    \ rS rSrSrS rS rS rSrg)"_UnHandledPromptBehaviorDescriptorW   aP  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                     Xl         g r   r   r   s     r   r    +_UnHandledPromptBehaviorDescriptor.__init__a   r"   r   c                 L    UR                   R                  U R                  5      $ r   r>   r?   s      r   r1   *_UnHandledPromptBehaviorDescriptor.__get__d   rA   r   c                 ^    US;   a  UR                  U R                  U5        g [        S5      e)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, ignorerC   r5   s      r   r6   *_UnHandledPromptBehaviorDescriptor.__set__g   s1    ^^tyy%0, r   r   NrF   r   r   r   rH   rH   W   s    (r   rH   c                   *    \ rS rSrSrS rS rS rSrg)_TimeoutsDescriptorq   a<  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                     Xl         g r   r   r   s     r   r    _TimeoutsDescriptor.__init__z   r"   r   c                 L    UR                   R                  U R                  5      $ r   r>   r?   s      r   r1   _TimeoutsDescriptor.__get__}   rA   r   c                     [        S UR                  5        5       5      (       a  UR                  U R                  U5        g [	        S5      e)Nc              3   (   #    U H	  oS ;   v   M     g7f))implicitpageLoadscriptNr   ).0xs     r   	<genexpr>._TimeoutsDescriptor.__set__.<locals>.<genexpr>   s     M166s   zITimeout keys can only be one of the following: implicit, pageLoad, script)allkeysr4   r   rD   r5   s      r   r6   _TimeoutsDescriptor.__set__   s9    M

MMMtyy%0hiir   r   NrF   r   r   r   rT   rT   q   s    (jr   rT   c                   *    \ rS rSrSrS rS rS rSrg)_ProxyDescriptor   z':Returns: Proxy if set, otherwise None.c                     Xl         g r   r   r   s     r   r    _ProxyDescriptor.__init__   r"   r   c                     UR                   $ r   )_proxyr?   s      r   r1   _ProxyDescriptor.__get__   s    zzr   c                     [        U[        5      (       d  [        S5      eX!l        UR	                  5       UR
                  U R                  '   g )Nz$Only Proxy objects can be passed in.)r,   r   r   rl   to_capabilitiesr*   r   r5   s      r   r6   _ProxyDescriptor.__set__   s;    %''*+QRR
$446		$))r   r   NrF   r   r   r   rg   rg      s    17r   rg   c            	         ^  \ rS rSrSr\" S5      r \" S5      r \" S5      r \" S5      r	 \" S5      r
 \" S5      r \" S	5      r \" S
5      r \" S5      r \" S5      r \" S5      r \" S5      r \" S	5      r SU 4S jjr\S 5       rSS jr   SS\R6                  \   S\R6                  \   S\R6                  \   SS4S jjr\S 5       r\\S 5       5       r SS jr!Sr"U =r#$ )BaseOptions   z*Base class for individual browser options.browserVersionplatformNamer&   r'   r(   r$   r%   pageLoadStrategyunhandledPromptBehaviortimeoutsproxyr)   returnNc                    > [         TU ]  5         U R                  U l        S U l        U R                  S[        R                  5        S U l        SU l	        g )Nrv   F)
superr    default_capabilitiesr*   rl   r4   r	   r   mobile_options_ignore_local_proxyr   	__class__s    r   r    BaseOptions.__init__  sJ    ..
.0@0G0GH"#( r   c                     U R                   $ r   r*   r   s    r   capabilitiesBaseOptions.capabilities  s    zzr   c                      X R                   U'   g)zSets a capability.Nr   )r   r   r0   s      r   r4   BaseOptions.set_capability  s     

4r   android_packageandroid_activitydevice_serialc                     U(       d  [        S5      eSU0U l        U(       a  X R                  S'   U(       a  X0R                  S'   gg)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   r   r   r   s       r   enable_mobileBaseOptions.enable_mobile  sI      !DEE/A5E 129F 56 r   c                     g)z-Convert options into capabilities dictionary.Nr   r   s    r   ro   BaseOptions.to_capabilities      r   c                     g)z6Return minimal capabilities necessary as a dictionary.Nr   r   s    r   r}    BaseOptions.default_capabilities  r   r   c                     SU l         g)YBy 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_variables4BaseOptions.ignore_local_proxy_environment_variables  s     $( r   )r*   r   rl   r~   rz   N)NNN)$r   r   r   r   r   r   browser_versionplatform_nameaccept_insecure_certsstrict_file_interactabilityset_window_rectenable_bidiweb_socket_urlr9   page_load_strategyrH   unhandled_prompt_behaviorrT   rx   rg   ry   enable_downloadsr    propertyr   r4   typingOptionalr-   r   r   ro   r}   r   r   __classcell__r   s   @r   rr   rr      s   4,-=>O* +>:M* 33HI* #99T"U* -_=O* )6K* ,N;N* 55GH* !CC\ ], #:.H, W%E* ..CD* ,N;N*)  ! 1515.2	G-G !//#.G s+	G
 
G& < < E  E( (r   rr   )	metaclassc                   t   ^  \ rS rSrSrSrSU 4S jjr\S 5       rSS jr	SU 4S jjr
S r\S	 5       rS
rU =r$ )
ArgOptionsi  z Binary Location Must be a Stringzfedcm:accountsc                 0   > [         TU ]  5         / U l        g r   )r|   r    
_argumentsr   s    r   r    ArgOptions.__init__  s    r   c                     U R                   $ )z5:Returns: A list of arguments needed for the browser.r   r   s    r   	argumentsArgOptions.arguments  s     r   c                 ^    U(       a  U R                   R                  U5        g[        S5      e)z<Adds an argument to the list.

:Args:
 - Sets the arguments
zargument can not be nullN)r   appendrD   )r   arguments     r   add_argumentArgOptions.add_argument  s%     OO""8,788r   c                 V   > [         R                  " S[        SS9  [        TU ]  5         g)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DeprecationWarningr|   r   r   s    r   r   3ArgOptions.ignore_local_proxy_environment_variables  s,     	M 	
 	8:r   c                     U R                   $ r   r   r   s    r   ro   ArgOptions.to_capabilities  s    zzr   c                     0 $ r   r   r   s    r   r}   ArgOptions.default_capabilities  s    	r   r   r   )r   r   r   r   BINARY_LOCATION_ERRORFEDCM_CAPABILITYr    r   r   r   r   ro   r}   r   r   r   s   @r   r   r     sK    >'  	9;  r   r   )r   r   abcr   r   enumr   selenium.common.exceptionsr   selenium.webdriver.common.proxyr   r-   r	   r   r9   rH   rT   rg   rr   r   r   r   r   <module>r      s{   "      ? 1sD  1 10_ _( 4j j,7 7 R(G R(j
, ,r   