
     f                        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e G d d                      Z		 	 	 	 dddZ
ddZddZdS )    )annotations   )event_classT_JSON_DICT)	dataclassNc                  Z    e Zd ZU dZdZded<   dZded<   dZded<   d	 Ze	d
             Z
dS )ScreenshotParamsz,
    Encoding options for a screenshot.
    Nztyping.Optional[str]format_ztyping.Optional[int]qualitytyping.Optional[bool]optimize_for_speedc                    t                      }| j        
| j        |d<   | j        
| j        |d<   | j        
| j        |d<   |S )Nformatr   optimizeForSpeed)dictr
   r   r   )selfjsons     /var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/selenium/webdriver/common/devtools/v127/headless_experimental.pyto_jsonzScreenshotParams.to_json   sM    vv<#!\DN<#"lDO".'+'>D#$    c                     | d|v rt          |d                   nd d|v rt          |d                   nd d|v rt          |d                   nd           S )Nr   r   r   )r
   r   r   )strintbool)clsr   s     r   	from_jsonzScreenshotParams.from_json%   sy    s+3t+;+;CX''',5,=,=CY(((4ASW[A[A[tD);$<===ae
 
 
 	
r   )__name__
__module____qualname____doc__r
   __annotations__r   r   r   classmethodr    r   r   r	   r	      s           %)G(((( %)G(((( 154444   
 
 [
 
 
r   r	   frame_time_tickstyping.Optional[float]intervalno_display_updatesr   
screenshot!typing.Optional[ScreenshotParams]returnTtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[bool, typing.Optional[str]]]c              #     K   t                      }| | |d<   |||d<   |||d<   ||                                |d<   d|d}|V }t          |d                   d	|v rt          |d	                   ndfS )
a  
    Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
    screenshot from the resulting frame. Requires that the target was created with enabled
    BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also
    https://goo.gle/chrome-headless-rendering for more background.

    :param frame_time_ticks: *(Optional)* Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, the current time will be used.
    :param interval: *(Optional)* The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
    :param no_display_updates: *(Optional)* Whether updates should not be committed and drawn onto the display. False by default. If true, only side effects of the BeginFrame will be run, such as layout and animations, but any visual updates may not be visible on the display or in screenshots.
    :param screenshot: *(Optional)* If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured. Note that capturing a screenshot can fail, for example, during renderer initialization. In such a case, no screenshot data will be returned.
    :returns: A tuple with the following items:

        0. **hasDamage** - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display. Reported for diagnostic uses, may be removed in the future.
        1. **screenshotData** - *(Optional)* Base64-encoded image data of the screenshot, if one was requested and successfully taken.
    NframeTimeTicksr&   noDisplayUpdatesr(   zHeadlessExperimental.beginFrame)methodparams	hasDamagescreenshotData)r   r   r   r   )r$   r&   r'   r(   r0   cmd_dictr   s          r   begin_framer4   .   s      * &&F##3 %z%%7!")1133|3 H >>DT+'74'?'?D!"###T r   0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]c               #     K   ddi} | V }dS )z2
    Disables headless events for the target.
    r/   zHeadlessExperimental.disableNr#   r3   r   s     r   disabler8   W   s$      
 	0H >>DDDr   c               #     K   ddi} | V }dS )z1
    Enables headless events for the target.
    r/   zHeadlessExperimental.enableNr#   r7   s     r   enabler:   a   s$      
 	/H >>DDDr   )NNNN)
r$   r%   r&   r%   r'   r   r(   r)   r*   r+   )r*   r5   )
__future__r   utilr   r   dataclassesr   enumtypingr	   r4   r8   r:   r#   r   r   <module>r@      s    # " " " " " * * * * * * * * ! ! ! ! ! !  

 
 
 
 
 
 
 
B 48+/488<	& & & & &R        r   