
     fTH                       d dl mZ ddlmZmZ d dlmZ d dlZd dlZddl	m
Z
  G d de          Z G d	 d
e          Ze G d d                      Ze G d d                      ZdZdZ	 d[d\dZd]dZd^dZ	 d[d_dZ	 	 	 d`dad!Zdbd#Z	 	 	 	 	 	 dcddd/Z	 	 dedfd3Zdgd5Z	 d[dhd7Zdid9Z	 	 dedjd;Z	 d[dkd?ZdldAZdmdDZ edE          e G dF dG                                  Z  edH          e G dI dJ                                  Z! edK          e G dL dM                                  Z" edN          e G dO dP                                  Z# edQ          e G dR dS                                  Z$ edT          e G dU dV                                  Z% edW          e G dX dY                                  Z&dS )n    )annotations   )event_classT_JSON_DICT)	dataclassN)browserc                  >     e Zd ZddZedd            Z fdZ xZS )	TargetIDreturnstrc                    | S N selfs    p/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/common/devtools/v85/target.pyto_jsonzTargetID.to_json           jsonc                     | |          S r   r   clsr   s     r   	from_jsonzTargetID.from_json       s4yyr   c                j    d                     t                                                                S )NzTargetID({})formatsuper__repr__r   	__class__s    r   r    zTargetID.__repr__   s'    $$UWW%5%5%7%7888r   r   r   )r   r   r   r
   )__name__
__module____qualname__r   classmethodr   r    __classcell__r"   s   @r   r
   r
      sl               [9 9 9 9 9 9 9 9 9r   r
   c                  B     e Zd ZdZddZed	d            Z fdZ xZS )
	SessionIDz:
    Unique identifier of attached debugging session.
    r   r   c                    | S r   r   r   s    r   r   zSessionID.to_json   r   r   r   c                     | |          S r   r   r   s     r   r   zSessionID.from_json"   r   r   c                j    d                     t                                                                S )NzSessionID({})r   r!   s    r   r    zSessionID.__repr__&   s'    %%egg&6&6&8&8999r   r#   )r   r   r   r+   )	r$   r%   r&   __doc__r   r'   r   r    r(   r)   s   @r   r+   r+      sv                [: : : : : : : : :r   r+   c                  z    e Zd ZU ded<   ded<   ded<   ded<   ded<   d	Zd
ed<   d	Zded<   d Zed             Zd	S )
TargetInfor
   	target_idr   type_titleurlboolattachedNtyping.Optional[TargetID]	opener_id)typing.Optional[browser.BrowserContextID]browser_context_idc                6   t                      }| j                                        |d<   | j        |d<   | j        |d<   | j        |d<   | j        |d<   | j        | j                                        |d<   | j        | j                                        |d<   |S )NtargetIdtyper4   r5   r7   openerIdbrowserContextId)	dictr2   r   r3   r4   r5   r7   r9   r;   r   r   s     r   r   zTargetInfo.to_json<   s    vv>1133ZzV
WhU=Z>%#~5577D".'+'>'F'F'H'HD#$r   c                    | t                               |d                   t          |d                   t          |d                   t          |d                   t          |d                   d|v r t                               |d                   nd d|v r%t          j                            |d                   nd           S )	Nr=   r>   r4   r5   r7   r?   r@   )r2   r3   r4   r5   r7   r9   r;   )r
   r   r   r6   r   BrowserContextIDr   s     r   r   zTargetInfo.from_jsonI   s    s((j)9::d6l##d7m$$DK  $z*++>HD>P>Ph((j)9:::VZ_quy_y_yw7AA$GYBZ[[[  @D
 
 
 	
r   )	r$   r%   r&   __annotations__r9   r;   r   r'   r   r   r   r   r1   r1   *   s         JJJJJJHHH NNN ,0I////DHHHHH   	
 	
 [	
 	
 	
r   r1   c                  @    e Zd ZU ded<   ded<   d Zed             ZdS )RemoteLocationr   hostintportc                J    t                      }| j        |d<   | j        |d<   |S )NrH   rJ   )rA   rH   rJ   rB   s     r   r   zRemoteLocation.to_json\   s&    vvyVyVr   c                h     | t          |d                   t          |d                             S )NrH   rJ   )rH   rJ   )r   rI   r   s     r   r   zRemoteLocation.from_jsonb   s9    sT&\""T&\""
 
 
 	
r   N)r$   r%   r&   rE   r   r'   r   r   r   r   rG   rG   V   sR         IIIIII   
 
 [
 
 
r   rG   r2   r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c              #  f   K   t                      }|                                 |d<   d|d}|V }dS )z@
    Activates (focuses) the target.

    :param target_id:
    r=   zTarget.activateTargetmethodparamsNrA   r   r2   rQ   cmd_dictr   s       r   activate_targetrU   j   sH       &&F"**,,F:) H >>DDDr   flattentyping.Optional[bool]5typing.Generator[T_JSON_DICT, T_JSON_DICT, SessionID]c              #     K   t                      }|                                 |d<   |||d<   d|d}|V }t                              |d                   S )aZ  
    Attaches to the target with given id.

    :param target_id:
    :param flatten: *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325.
    :returns: Id assigned to the session.
    r=   NrV   zTarget.attachToTargetrO   	sessionId)rA   r   r+   r   )r2   rV   rQ   rT   r   s        r   attach_to_targetr[   {   sm       &&F"**,,F:#y) H >>DtK0111r   c               #  V   K   ddi} | V }t                               |d                   S )z
    Attaches to the browser target, only uses flat sessionId mode.

    **EXPERIMENTAL**

    :returns: Id assigned to the session.
    rP   zTarget.attachToBrowserTargetrZ   )r+   r   rT   r   s     r   attach_to_browser_targetr^      s9       	0H >>DtK0111r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, bool]c              #     K   t                      }|                                 |d<   d|d}|V }t          |d                   S )zp
    Closes the target. If the target is a page that gets closed too.

    :param target_id:
    :returns: 
    r=   zTarget.closeTargetrO   success)rA   r   r6   rS   s       r   close_targetrb      sV       &&F"**,,F:& H >>DY   r   binding_nametyping.Optional[str]c              #  t   K   t                      }|                                 |d<   |||d<   d|d}|V }dS )a@  
    Inject object to the target's main frame that provides a communication
    channel with browser target.

    Injected object will be available as ``window[bindingName]``.

    The object has the follwing API:
    - ``binding.send(json)`` - a method to send messages over the remote debugging protocol
    - ``binding.onmessage = json => handleMessage(json)`` - a callback that will be called for the protocol notifications and command responses.

    **EXPERIMENTAL**

    :param target_id:
    :param binding_name: *(Optional)* Binding name, 'cdp' if not specified.
    r=   NbindingNamezTarget.exposeDevToolsProtocolrO   rR   )r2   rc   rQ   rT   r   s        r   expose_dev_tools_protocolrg      sX      & &&F"**,,F: ,}1 H >>DDDr   dispose_on_detachproxy_serverproxy_bypass_listDtyping.Generator[T_JSON_DICT, T_JSON_DICT, browser.BrowserContextID]c              #     K   t                      }| | |d<   |||d<   |||d<   d|d}|V }t          j                            |d                   S )a  
    Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than
    one.

    **EXPERIMENTAL**

    :param dispose_on_detach: *(Optional)* If specified, disposes this context when debugging session disconnects.
    :param proxy_server: *(Optional)* Proxy server, similar to the one passed to --proxy-server
    :param proxy_bypass_list: *(Optional)* Proxy bypass list, similar to the one passed to --proxy-bypass-list
    :returns: The id of the context created.
    NdisposeOnDetachproxyServerproxyBypassListzTarget.createBrowserContextrO   r@   )rA   r   rD   r   )rh   ri   rj   rQ   rT   r   s         r   create_browser_contextrp      s}        &&F$$5 ! ,}$$5 !/ H >>D#--d3E.FGGGr   Qtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[browser.BrowserContextID]]c               #  :   K   ddi} | V }d |d         D             S )z
    Returns all browser contexts created with ``Target.createBrowserContext`` method.

    **EXPERIMENTAL**

    :returns: An array of browser context ids.
    rP   zTarget.getBrowserContextsc                L    g | ]!}t           j                            |          "S r   )r   rD   r   .0is     r   
<listcomp>z(get_browser_contexts.<locals>.<listcomp>   s)    UUUaG$..q11UUUr   browserContextIdsr   r]   s     r   get_browser_contextsry      s:       	-H >>DUU4@S;TUUUUr   r5   r   widthtyping.Optional[int]heightr;   r:   enable_begin_frame_control
new_window
background4typing.Generator[T_JSON_DICT, T_JSON_DICT, TargetID]c              #     K   t                      }| |d<   |||d<   |||d<   ||                                |d<   |||d<   |||d<   |||d<   d	|d
}|V }	t                              |	d                   S )a-  
    Creates a new page.

    :param url: The initial URL the page will be navigated to.
    :param width: *(Optional)* Frame width in DIP (headless chrome only).
    :param height: *(Optional)* Frame height in DIP (headless chrome only).
    :param browser_context_id: *(Optional)* The browser context to create the page in.
    :param enable_begin_frame_control: **(EXPERIMENTAL)** *(Optional)* Whether BeginFrames for this target will be controlled via DevTools (headless chrome only, not supported on MacOS yet, false by default).
    :param new_window: *(Optional)* Whether to create a new Window or Tab (chrome-only, false by default).
    :param background: *(Optional)* Whether to create the target in background or foreground (chrome-only, false by default).
    :returns: The id of the page opened.
    r5   Nrz   r|   r@   enableBeginFrameControl	newWindowr   zTarget.createTargetrO   r=   )rA   r   r
   r   )
r5   rz   r|   r;   r}   r~   r   rQ   rT   r   s
             r   create_targetr      s      * &&FF5Mw!x%%7%?%?%A%A!"!-,F()({)|' H >>Dd:.///r   
session_idtyping.Optional[SessionID]r8   c              #     K   t                      }| |                                 |d<   ||                                |d<   d|d}|V }dS )z
    Detaches session with given id.

    :param session_id: *(Optional)* Session to detach.
    :param target_id: *(Optional)* Deprecated.
    NrZ   r=   zTarget.detachFromTargetrO   rR   )r   r2   rQ   rT   r   s        r   detach_from_targetr   +  sj       &&F(0022{&..00z+ H >>DDDr   browser.BrowserContextIDc              #  f   K   t                      }|                                 |d<   d|d}|V }dS )z
    Deletes a BrowserContext. All the belonging pages will be closed without calling their
    beforeunload hooks.

    **EXPERIMENTAL**

    :param browser_context_id:
    r@   zTarget.disposeBrowserContextrO   NrR   )r;   rQ   rT   r   s       r   dispose_browser_contextr   A  sI       &&F!3!;!;!=!=F0 H >>DDDr   6typing.Generator[T_JSON_DICT, T_JSON_DICT, TargetInfo]c              #     K   t                      }| |                                 |d<   d|d}|V }t                              |d                   S )zv
    Returns information about a target.

    **EXPERIMENTAL**

    :param target_id: *(Optional)*
    :returns: 
    Nr=   zTarget.getTargetInforO   
targetInfo)rA   r   r1   r   rS   s       r   get_target_infor   U  sc       &&F&..00z( H >>D\ 2333r   Ctyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[TargetInfo]]c               #  :   K   ddi} | V }d |d         D             S )zT
    Retrieves a list of available targets.

    :returns: The list of targets.
    rP   zTarget.getTargetsc                B    g | ]}t                               |          S r   r1   r   rt   s     r   rw   zget_targets.<locals>.<listcomp>u  s&    AAAJ  ##AAAr   targetInfosr   r]   s     r   get_targetsr   k  s9       	%H >>DAAT--@AAAAr   messagec              #     K   t                      }| |d<   ||                                |d<   ||                                |d<   d|d}|V }dS )a+  
    Sends protocol message over session with given id.
    Consider using flat mode instead; see commands attachToTarget, setAutoAttach,
    and crbug.com/991325.

    :param message:
    :param session_id: *(Optional)* Identifier of the session.
    :param target_id: *(Optional)* Deprecated.
    r   NrZ   r=   zTarget.sendMessageToTargetrO   rR   )r   r   r2   rQ   rT   r   s         r   send_message_to_targetr   x  st       &&FF9(0022{&..00z. H >>DDDr   auto_attachr6   wait_for_debugger_on_startc              #  Z   K   t                      }| |d<   ||d<   |||d<   d|d}|V }dS )a  
    Controls whether to automatically attach to new targets which are considered to be related to
    this one. When turned on, attaches to all existing related targets as well. When turned off,
    automatically detaches from all currently attached targets.

    **EXPERIMENTAL**

    :param auto_attach: Whether to auto-attach to related targets.
    :param wait_for_debugger_on_start: Whether to pause new targets when attaching to them. Use ```Runtime.runIfWaitingForDebugger``` to run paused targets.
    :param flatten: *(Optional)* Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325.
    
autoAttachwaitForDebuggerOnStartNrV   zTarget.setAutoAttachrO   rA   )r   r   rV   rQ   rT   r   s         r   set_auto_attachr     sW        &&F&F<'AF#$#y( H >>DDDr   discoverc              #  B   K   t                      }| |d<   d|d}|V }dS )z
    Controls whether to discover available targets and notify via
    ``targetCreated/targetInfoChanged/targetDestroyed`` events.

    :param discover: Whether to discover available targets.
    r   zTarget.setDiscoverTargetsrO   Nr   )r   rQ   rT   r   s       r   set_discover_targetsr     s<       &&F!F:- H >>DDDr   	locationstyping.List[RemoteLocation]c              #  V   K   t                      }d | D             |d<   d|d}|V }dS )z
    Enables target discovery for the specified locations, when ``setDiscoverTargets`` was set to
    ``true``.

    **EXPERIMENTAL**

    :param locations: List of remote locations.
    c                6    g | ]}|                                 S r   )r   rt   s     r   rw   z(set_remote_locations.<locals>.<listcomp>  s     :::1199;;:::r   r   zTarget.setRemoteLocationsrO   Nr   )r   rQ   rT   r   s       r   set_remote_locationsr     sJ       &&F::	:::F;- H >>DDDr   zTarget.attachedToTargetc                  J    e Zd ZU dZded<   ded<   ded<   edd            ZdS )AttachedToTargetzt
    **EXPERIMENTAL**

    Issued when attached to target because of auto-attach or ``attachToTarget`` command.
    r+   r   r1   target_infor6   waiting_for_debuggerr   r   r   c                     | t                               |d                   t                              |d                   t          |d                             S )NrZ   r   waitingForDebugger)r   r   r   )r+   r   r1   r6   r   s     r   r   zAttachedToTarget.from_json  sX    s **4+<==",,T,-?@@!%d+?&@!A!A
 
 
 	
r   N)r   r   r   r   r$   r%   r&   r/   rE   r'   r   r   r   r   r   r     sd           
 
 
 [
 
 
r   r   zTarget.detachedFromTargetc                  @    e Zd ZU dZded<   ded<   edd	            Zd
S )DetachedFromTargetz
    **EXPERIMENTAL**

    Issued when detached from target for any reason (including ``detachFromTarget`` command). Can be
    issued multiple times per target if multiple sessions have been attached to it.
    r+   r   r8   r2   r   r   r   c                     | t                               |d                   d|v r t                              |d                   nd           S )NrZ   r=   )r   r2   )r+   r   r
   r   s     r   r   zDetachedFromTarget.from_json  sW    s **4+<==>HD>P>Ph((j)9:::VZ
 
 
 	
r   N)r   r   r   r   r   r   r   r   r   r     sX           ((((
 
 
 [
 
 
r   r   z Target.receivedMessageFromTargetc                  J    e Zd ZU dZded<   ded<   ded<   edd            ZdS )ReceivedMessageFromTargetzz
    Notifies about a new protocol message received from the session (as reported in
    ``attachedToTarget`` event).
    r+   r   r   r   r8   r2   r   r   r   c                     | t                               |d                   t          |d                   d|v r t                              |d                   nd           S )NrZ   r   r=   )r   r   r2   )r+   r   r   r
   r   s     r   r   z#ReceivedMessageFromTarget.from_json  sf    s **4+<==Y((>HD>P>Ph((j)9:::VZ
 
 
 	
r   N)r   r   r   r   r   r   r   r   r   r     sa          
 LLL((((
 
 
 [
 
 
r   r   zTarget.targetCreatedc                  6    e Zd ZU dZded<   ed	d            ZdS )
TargetCreatedz>
    Issued when a possible inspection target is created.
    r1   r   r   r   r   c                V     | t                               |d                             S Nr   )r   r   r   s     r   r   zTargetCreated.from_json  1    s",,T,-?@@
 
 
 	
r   N)r   r   r   r   r   r   r   r   r   r     sL           
 
 
 [
 
 
r   r   zTarget.targetDestroyedc                  6    e Zd ZU dZded<   ed	d            ZdS )
TargetDestroyedz,
    Issued when a target is destroyed.
    r
   r2   r   r   r   c                V     | t                               |d                             S )Nr=   )r2   )r
   r   r   s     r   r   zTargetDestroyed.from_json.  s1    s((j)9::
 
 
 	
r   N)r   r   r   r   r   r   r   r   r   r   &  sL           
 
 
 [
 
 
r   r   zTarget.targetCrashedc                  J    e Zd ZU dZded<   ded<   ded<   edd            ZdS )TargetCrashedz+
    Issued when a target has crashed.
    r
   r2   r   statusrI   
error_coder   r   r   c                     | t                               |d                   t          |d                   t          |d                             S )Nr=   r   	errorCode)r2   r   r   )r
   r   r   rI   r   s     r   r   zTargetCrashed.from_jsonA  sP    s((j)9::tH~&&4,--
 
 
 	
r   N)r   r   r   r   r   r   r   r   r   r   5  s^           KKKOOO
 
 
 [
 
 
r   r   zTarget.targetInfoChangedc                  6    e Zd ZU dZded<   ed	d            ZdS )
TargetInfoChangedz
    Issued when some information about a target has changed. This only happens between
    ``targetCreated`` and ``targetDestroyed``.
    r1   r   r   r   r   c                V     | t                               |d                             S r   r   r   s     r   r   zTargetInfoChanged.from_jsonS  r   r   N)r   r   r   r   r   r   r   r   r   r   J  sL           
 
 
 [
 
 
r   r   )r2   r
   r   rM   r   )r2   r
   rV   rW   r   rX   )r   rX   )r2   r
   r   r_   )r2   r
   rc   rd   r   rM   )NNN)rh   rW   ri   rd   rj   rd   r   rk   )r   rq   )NNNNNN)r5   r   rz   r{   r|   r{   r;   r:   r}   rW   r~   rW   r   rW   r   r   )NN)r   r   r2   r8   r   rM   )r;   r   r   rM   )r2   r8   r   r   )r   r   )r   r   r   r   r2   r8   r   rM   )r   r6   r   r6   rV   rW   r   rM   )r   r6   r   rM   )r   r   r   rM   )'
__future__r   utilr   r   dataclassesr   enumtyping r   r   r
   r+   r1   rG   rU   r[   r^   rb   rg   rp   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s   # " " " " " * * * * * * * * ! ! ! ! ! !        	9 	9 	9 	9 	9s 	9 	9 	9: : : : : : : : (
 (
 (
 (
 (
 (
 (
 (
V 
 
 
 
 
 
 
 
&   & *.2 2 2 2 2.2 2 2 2! ! ! !* .2    > 48-126H H H H H>V V V V" '+'+HL<@,0,0(0 (0 (0 (0 (0X 26/3    ,   * 044 4 4 4 4,
B 
B 
B 
B 26/3    < *.    8   $   ( &''

 
 
 
 
 
 
  ('
( ())

 
 
 
 
 
 
  *)
( /00

 
 
 
 
 
 
  10
( #$$


 

 

 

 

 

 

  %$

 %&&


 

 

 

 

 

 

  '&

 #$$

 
 
 
 
 
 
  %$
& '((

 
 
 
 
 
 
  )(
 
 
r   