
    /_i1                         d dl Z d dlmZ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)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        `/var/www/html/land_sniper/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__.   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,   r0   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.

    See:
      - https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies.

    Args:
        strategy: the strategy corresponding to a document readiness state
    c                     || _         y r   r   r   s     r   r   z$_PageLoadStrategyDescriptor.__init__L   r   r   c                 L    |j                   j                  | j                        S r   r%   r&   r   r   r)   r*   s      r   r,   z#_PageLoadStrategyDescriptor.__get__O       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   
ValueErrorr/   s      r   r0   z#_PageLoadStrategyDescriptor.__set__R   s+    //tyy%0]^^r   Nr   r   r   r   r   r,   r0   r   r   r   r2   r2   B   s    (_r   r2   c                   "    e Zd ZdZd Zd Zd Zy)"_UnHandledPromptBehaviorDescriptora{  How the driver should respond when an alert is present and the command sent is not handling the alert.

    See:
      - https://w3c.github.io/webdriver/#dfn-table-of-page-load-strategies:

    Args:
        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__f   r   r   c                 L    |j                   j                  | j                        S r   r5   r6   s      r   r,   z*_UnHandledPromptBehaviorDescriptor.__get__i   r7   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, ignorer9   r/   s      r   r0   z*_UnHandledPromptBehaviorDescriptor.__set__l   s1    ^^tyy%0, r   Nr;   r   r   r   r=   r=   Y   s    
(r   r=   c                   "    e Zd ZdZd Zd Zd Zy)_TimeoutsDescriptorag  How long the driver should wait for actions to complete before returning an error.

    See:
      - https://w3c.github.io/webdriver/#timeouts

    Args:
        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   r5   r6   s      r   r,   z_TimeoutsDescriptor.__get__   r7   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:   r/   s      r   r0   z_TimeoutsDescriptor.__set__   s6    M

MMtyy%0hiir   Nr;   r   r   r   rE   rE   v   s    
(jr   rE   c                   "    e Zd ZdZd Zd Zd Zy)_ProxyDescriptorz^Descriptor for proxy property access.

    Returns:
        Proxy if set, otherwise None.
    c                     || _         y r   r   r   s     r   r   z_ProxyDescriptor.__init__   r   r   c                     |j                   S r   )_proxyr6   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   rV   to_capabilitiesr%   r   r/   s      r   r0   z_ProxyDescriptor.__set__   s:    %'*+QRR
$446		$))r   Nr;   r   r   r   rS   rS      s    7r   rS   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dz  dedz  dedz  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%   rV   r.   r	   r
   mobile_options_ignore_local_proxyr   	__class__s    r   r   zBaseOptions.__init__O  sJ    ..
.0@0G0GH59#( r   c                     | j                   S r   r%   r   s    r   capabilitieszBaseOptions.capabilitiesW  s    zzr   c                 "    || j                   |<   y)zSets a capability.Nrj   )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)a	  Enables mobile browser use for browsers that support it.

        Args:
            android_package: The name of the android package to start
            android_activity: The name of the android activity
            device_serial: The device serial number
        z!android_package must be passed inandroidPackageandroidActivityandroidDeviceSerialN)AttributeErrorre   )r   rn   ro   rp   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   rk   s    r   rX   zBaseOptions.to_capabilitiest      r   c                      y)z6Return minimal capabilities necessary as a dictionary.Nr   rk   s    r   rd   z BaseOptions.default_capabilitiesx  rx   r   c                     d| _         y)z8Ignore HTTP_PROXY and HTTPS_PROXY environment variables.TN)rf   rk   s    r   (ignore_local_proxy_environment_variablesz4BaseOptions.ignore_local_proxy_environment_variables}  s
    #' r   ra   N)NNN) r   r   r   r   r   browser_versionplatform_nameaccept_insecure_certsstrict_file_interactabilityset_window_rectenable_bidir2   page_load_strategyr=   unhandled_prompt_behaviorrE   r_   rS   r`   enable_downloadsweb_socket_urlr   propertyrl   r.   r(   rv   r   rX   rd   r{   __classcell__rh   s   @r   rZ   rZ      sx   4,-=>O +>:M 33HI #99T"U -_=O )6K 55GH !CC\ ] #:.H W%E ..CD ,N;N)  ! '+'+$(	GtG *G Tz	G
 
G* < < E  E(r   rZ   )	metaclassc                   j     e Zd ZdZdZd fdZed        ZdeddfdZ	d fd	Z
d
 Zed        Z xZS )
ArgOptionsz Binary Location Must be a Stringzfedcm:accountsra   Nc                 0    t         |           g | _        y r   )rc   r   
_argumentsrg   s    r   r   zArgOptions.__init__  s    %'r   c                     | j                   S )z3Returns a list of arguments needed for the browser.)r   rk   s    r   	argumentszArgOptions.arguments  s     r   argumentc                 T    |r| j                   j                  |       yt        d      )z^Adds an argument to the list.

        Args:
            argument: Sets the arguments
        zargument can not be nullN)r   appendr:   )r   r   s     r   add_argumentzArgOptions.add_argument  s%     OO""8,788r   c                 Z    t        j                  dt        d       t        |           y)zIgnore HTTP_PROXY and HTTPS_PROXY environment variables.

        This method is deprecated; use a Proxy instance with ProxyType.DIRECT instead.
        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DeprecationWarningrc   r{   rg   s    r   r{   z3ArgOptions.ignore_local_proxy_environment_variables  s,    
 	M 	
 	8:r   c                     | j                   S r   rj   rk   s    r   rX   zArgOptions.to_capabilities  s    zzr   c                     i S r   r   rk   s    r   rd   zArgOptions.default_capabilities  s    	r   r|   )r   r   r   BINARY_LOCATION_ERRORFEDCM_CAPABILITYr   r   r   r(   r   r{   rX   rd   r   r   s   @r   r   r     sY    >'(  	9S 	9T 	9;   r   r   )r   abcr   r   enumr   selenium.common.exceptionsr   selenium.webdriver.common.proxyr   r(   r	   r   r2   r=   rE   rS   rZ   r   r   r   r   <module>r      su   $  '  ? 1sD  1 10_ _. :j j47 7([(G [(|. .r   