a
    xd                    @  s  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
 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 deZeG dd dZeG dd dZeG dd dZeG dd dZG dd deZG dd dejZeG dd dZeG dd dZG dd dejZeG d d! d!ZeG d"d# d#ZeG d$d% d%ZeG d&d' d'ZeG d(d) d)Z eG d*d+ d+Z!eG d,d- d-Z"G d.d/ d/ejZ#G d0d1 d1ejZ$eG d2d3 d3Z%eG d4d5 d5Z&G d6d7 d7ejZ'd8d9d:d;d<Z(d&d8d=d9d>d?d@Z)dAdBdCdDZ*d'd=dEdFdGdHdIdJdKZ+d(d=dHdLdMdNZ,dAdBdOdPZ-dAdBdQdRZ.dAdBdSdTZ/d)dd=dGdUdVdWdXZ0d8d8dAdYdZd[Z1dAdBd\d]Z2dAdBd^d_Z3d`dBdadbZ4dcdBdddeZ5dfdBdgdhZ6didBdjdkZ7dldBdmdnZ8dodBdpdqZ9drdBdsdtZ:dAdBdudvZ;dd8dwdxdydzZ<d{dBd|d}Z=d*d~d=dAdddZ>d+d8d=dddddddZ?ddAdddZ@d,dGdGdGdddddddd=dGd=d=dGd=ddddZAd-dGd=dAdddZBddAdddZCddAdddZDddAdddZEd.dd8d8dGdGddddZFd~dAdddZGd~dAdddZHd/dddd~ddEdEdEdEdGddFdAdddZIddddAdddZJd+dAdddZKd-dAdddZLdd8dAdddZMd0d8d=dAdddZNd1ddddAdddZOd~dAdddZPd2d~d=dAdddZQd3d=dEdEdEdEdAdddĄZRdAdBddƄZSdAdBddȄZTdAdBddʄZUd8dAd˜dd̈́ZVdAdBddτZWd~dAdddфZXd8d8dAdҜddԄZYdAdBddքZZd4d8d=dAdלddلZ[dAdBddۄZ\d~dAddd݄Z]edރeG dd dZ^edeG dd dZ_edeG dd dZ`edeG dd dZaedeG dd dZbedeG dd dZcedeG dd dZdedeG dd dZeedeG dd dZfedeG dd dZgedeG dd dZhedeG d d dZiedeG dd dZjedeG dd dZkedeG d	d
 d
ZledeG dd dZmedeG dd dZnedeG dd dZoedeG dd dZpedeG dd dZqedeG dd dZredeG dd dZsed eG d!d" d"Zted#eG d$d% d%ZudS (5      )annotations   )event_classT_JSON_DICT)	dataclassN)debugger)dom)	emulation)io)network)runtimec                      sB   e Zd ZdZddddZedd dddZ fd	d
Z  ZS )FrameIdz"
    Unique frame identifier.
    strreturnc                 C  s   | S N selfr   r   c/var/www/html/Ranjet/env/lib/python3.9/site-packages/selenium/webdriver/common/devtools/v85/page.pyto_json   s    zFrameId.to_jsonjsonr   c                 C  s   | |S r   r   clsr   r   r   r   	from_json   s    zFrameId.from_jsonc                   s   d t  S )NzFrameId({})formatsuper__repr__r   	__class__r   r   r      s    zFrameId.__repr__	__name__
__module____qualname____doc__r   classmethodr   r   __classcell__r   r   r    r   r      s
   r   c                   @  s~   e Zd ZU dZ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ded< d
Zded< dd Z	e
dd Zd
S )Framez2
    Information about the Frame on the page.
    r   id_network.LoaderId	loader_idr   urlsecurity_origin	mime_typeNtyping.Optional[str]	parent_idnameurl_fragmentunreachable_urlc                 C  s   t  }| j |d< | j |d< | j|d< | j|d< | j|d< | jd urT| j|d< | jd urh| j|d< | j	d ur|| j	|d< | j
d ur| j
|d	< |S )
NidloaderIdr-   securityOriginmimeTypeparentIdr2   urlFragmentunreachableUrl)dictr*   r   r,   r-   r.   r/   r1   r2   r3   r4   r   r   r   r   r   r   C   s    










zFrame.to_jsonc                 C  s   | t |d tj|d t|d t|d t|d d|v rNt|d nd d|v rdt|d nd d|v rzt|d nd d	|v rt|d	 nd d
	S )Nr5   r6   r-   r7   r8   r9   r2   r:   r;   )	r*   r,   r-   r.   r/   r1   r2   r3   r4   )r   r   r   LoaderIdr   r   r   r   r   r   T   s    


zFrame.from_json)r#   r$   r%   r&   __annotations__r1   r2   r3   r4   r   r'   r   r   r   r   r   r)   #   s   
r)   c                   @  sn   e Zd ZU dZded< ded< ded< dZded	< dZd
ed< dZded< dZded< dd Z	e
dd ZdS )FrameResourcez5
    Information about the Resource on the page.
    r   r-   znetwork.ResourceTypetype_r/   N'typing.Optional[network.TimeSinceEpoch]last_modifiedtyping.Optional[float]content_sizetyping.Optional[bool]failedcanceledc                 C  s   t  }| j|d< | j |d< | j|d< | jd ur@| j |d< | jd urT| j|d< | jd urh| j|d< | jd ur|| j|d< |S )Nr-   typer8   lastModifiedcontentSizerG   rH   )	r<   r-   rA   r   r/   rC   rE   rG   rH   r=   r   r   r   r   }   s    








zFrameResource.to_jsonc              
   C  s   | t |d tj|d t |d d|v r<tj|d nd d|v rRt|d nd d|v rht|d nd d|v r~t|d nd dS )	Nr-   rI   r8   rJ   rK   rG   rH   )r-   rA   r/   rC   rE   rG   rH   )r   r   ZResourceTyper   TimeSinceEpochfloatboolr   r   r   r   r      s    

zFrameResource.from_json)r#   r$   r%   r&   r?   rC   rE   rG   rH   r   r'   r   r   r   r   r   r@   c   s   
r@   c                   @  sB   e Zd ZU dZded< ded< dZded< d	d
 Zedd ZdS )FrameResourceTreezR
    Information about the Frame hierarchy along with their cached resources.
    r)   frameztyping.List[FrameResource]	resourcesNz/typing.Optional[typing.List[FrameResourceTree]]child_framesc                 C  sJ   t  }| j |d< dd | jD |d< | jd urFdd | jD |d< |S )NrP   c                 S  s   g | ]}|  qS r   r   .0ir   r   r   
<listcomp>       z-FrameResourceTree.to_json.<locals>.<listcomp>rQ   c                 S  s   g | ]}|  qS r   rS   rT   r   r   r   rW      rX   childFrames)r<   rP   r   rQ   rR   r=   r   r   r   r      s    
zFrameResourceTree.to_jsonc                 C  s@   | t |d dd |d D d|v r8dd |d D nd dS )NrP   c                 S  s   g | ]}t |qS r   )r@   r   rT   r   r   r   rW      rX   z/FrameResourceTree.from_json.<locals>.<listcomp>rQ   rY   c                 S  s   g | ]}t |qS r   rO   r   rT   r   r   r   rW      rX   )rP   rQ   rR   r)   r   r   r   r   r   r      s
    zFrameResourceTree.from_json	r#   r$   r%   r&   r?   rR   r   r'   r   r   r   r   r   rO      s   
rO   c                   @  s:   e Zd ZU dZded< dZded< dd Zed	d
 ZdS )	FrameTreez0
    Information about the Frame hierarchy.
    r)   rP   Nz'typing.Optional[typing.List[FrameTree]]rR   c                 C  s6   t  }| j |d< | jd ur2dd | jD |d< |S )NrP   c                 S  s   g | ]}|  qS r   rS   rT   r   r   r   rW      rX   z%FrameTree.to_json.<locals>.<listcomp>rY   )r<   rP   r   rR   r=   r   r   r   r      s
    
zFrameTree.to_jsonc                 C  s0   | t |d d|v r(dd |d D nd dS )NrP   rY   c                 S  s   g | ]}t |qS r   r]   r   rT   r   r   r   rW      rX   z'FrameTree.from_json.<locals>.<listcomp>)rP   rR   r[   r   r   r   r   r      s    zFrameTree.from_jsonr\   r   r   r   r   r]      s   
r]   c                      sB   e Zd ZdZddddZedd dddZ fd	d
Z  ZS )ScriptIdentifierz#
    Unique script identifier.
    r   r   c                 C  s   | S r   r   r   r   r   r   r      s    zScriptIdentifier.to_jsonr   c                 C  s   | |S r   r   r   r   r   r   r      s    zScriptIdentifier.from_jsonc                   s   d t  S )NzScriptIdentifier({})r   r   r    r   r   r      s    zScriptIdentifier.__repr__r"   r   r   r    r   r_      s
   r_   c                   @  sX   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdd Zedd ZdS )TransitionTypez
    Transition type.
    linktypedZaddress_barZauto_bookmarkZauto_subframeZmanual_subframe	generatedZauto_toplevelZform_submitreloadkeywordZkeyword_generatedotherc                 C  s   | j S r   valuer   r   r   r   r      s    zTransitionType.to_jsonc                 C  s   | |S r   r   r   r   r   r   r      s    zTransitionType.from_jsonN)r#   r$   r%   r&   ZLINKZTYPEDZADDRESS_BARZAUTO_BOOKMARKZAUTO_SUBFRAMEZMANUAL_SUBFRAMEZ	GENERATEDZAUTO_TOPLEVELZFORM_SUBMITRELOADZKEYWORDZKEYWORD_GENERATEDOTHERr   r'   r   r   r   r   r   r`      s"   r`   c                   @  sN   e Zd ZU dZded< ded< ded< ded< ded	< d
d Zedd ZdS )NavigationEntryz#
    Navigation history entry.
    intr*   r   r-   user_typed_urltitler`   transition_typec                 C  s@   t  }| j|d< | j|d< | j|d< | j|d< | j |d< |S )Nr5   r-   userTypedURLrn   transitionType)r<   r*   r-   rm   rn   ro   r   r=   r   r   r   r     s    



zNavigationEntry.to_jsonc              	   C  s<   | t |d t|d t|d t|d t|d dS )Nr5   r-   rp   rn   rq   )r*   r-   rm   rn   ro   )rl   r   r`   r   r   r   r   r   r     s    



zNavigationEntry.from_jsonNr#   r$   r%   r&   r?   r   r'   r   r   r   r   r   rk      s   
	rk   c                   @  sb   e Zd ZU dZded< ded< ded< ded< ded< ded< d	Zd
ed< dd Zedd Zd	S )ScreencastFrameMetadataz$
    Screencast frame metadata.
    rM   
offset_toppage_scale_factordevice_widthdevice_heightscroll_offset_xscroll_offset_yNrB   	timestampc                 C  s^   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | jd urZ| j |d< |S )N	offsetToppageScaleFactordeviceWidthdeviceHeightscrollOffsetXscrollOffsetYrz   )	r<   rt   ru   rv   rw   rx   ry   rz   r   r=   r   r   r   r   =  s    






zScreencastFrameMetadata.to_jsonc                 C  s^   | t |d t |d t |d t |d t |d t |d d|v rVtj|d nd dS )	Nr{   r|   r}   r~   r   r   rz   )rt   ru   rv   rw   rx   ry   rz   )rM   r   rL   r   r   r   r   r   r   I  s    





z!ScreencastFrameMetadata.from_json)	r#   r$   r%   r&   r?   rz   r   r'   r   r   r   r   r   rs   #  s   
rs   c                   @  s4   e Zd ZdZdZdZdZdZdd Ze	dd	 Z
d
S )
DialogTypez!
    Javascript dialog type.
    alertZconfirmpromptZbeforeunloadc                 C  s   | j S r   rg   r   r   r   r   r   _  s    zDialogType.to_jsonc                 C  s   | |S r   r   r   r   r   r   r   b  s    zDialogType.from_jsonN)r#   r$   r%   r&   ALERTZCONFIRMZPROMPTZBEFOREUNLOADr   r'   r   r   r   r   r   r   V  s   r   c                   @  sF   e Zd ZU dZded< ded< ded< ded< dd	 Zed
d ZdS )AppManifestErrorz*
    Error while paring app manifest.
    r   messagerl   criticallinecolumnc                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )Nr   r   r   r   )r<   r   r   r   r   r=   r   r   r   r   x  s    



zAppManifestError.to_jsonc                 C  s0   | t |d t|d t|d t|d dS )Nr   r   r   r   )r   r   r   r   )r   rl   r   r   r   r   r     s    



zAppManifestError.from_jsonNrr   r   r   r   r   r   g  s   
r   c                   @  s.   e Zd ZU dZded< dd Zedd ZdS )	AppManifestParsedPropertiesz)
    Parsed app manifest properties.
    r   scopec                 C  s   t  }| j|d< |S )Nr   )r<   r   r=   r   r   r   r     s    
z#AppManifestParsedProperties.to_jsonc                 C  s   | t |d dS )Nr   )r   r   r   r   r   r   r     s    
z%AppManifestParsedProperties.from_jsonNrr   r   r   r   r   r     s
   
r   c                   @  sF   e Zd ZU dZded< ded< ded< ded< dd Zed	d
 ZdS )LayoutViewportz2
    Layout viewport position and dimensions.
    rl   page_xpage_yclient_widthclient_heightc                 C  s2   t  }| j|d< | j|d< | j|d< | j|d< |S )NpageXpageYclientWidthclientHeight)r<   r   r   r   r   r=   r   r   r   r     s    



zLayoutViewport.to_jsonc                 C  s0   | t |d t |d t |d t |d dS )Nr   r   r   r   )r   r   r   r   rl   r   r   r   r   r     s    



zLayoutViewport.from_jsonNrr   r   r   r   r   r     s   
r   c                   @  sj   e Zd ZU dZded< ded< ded< ded< ded< ded< ded	< d
Zded< dd Zedd Zd
S )VisualViewportz:
    Visual viewport position, dimensions, and scale.
    rM   offset_xoffset_yr   r   r   r   scaleNrD   zoomc                 C  sd   t  }| j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | j|d< | jd ur`| j|d< |S )	NoffsetXoffsetYr   r   r   r   r   r   )	r<   r   r   r   r   r   r   r   r   r=   r   r   r   r     s    








zVisualViewport.to_jsonc                 C  sd   | t |d t |d t |d t |d t |d t |d t |d d|v r\t |d nd d	S )
Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   rM   r   r   r   r   r     s    






zVisualViewport.from_json)	r#   r$   r%   r&   r?   r   r   r'   r   r   r   r   r   r     s   
r   c                   @  sN   e Zd ZU dZded< ded< ded< ded< ded< dd	 Zed
d ZdS )Viewportz,
    Viewport for capturing screenshot.
    rM   xywidthheightr   c                 C  s<   t  }| j|d< | j|d< | j|d< | j|d< | j|d< |S )Nr   r   r   r   r   )r<   r   r   r   r   r   r=   r   r   r   r     s    




zViewport.to_jsonc                 C  s:   | t |d t |d t |d t |d t |d dS )Nr   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r     s    




zViewport.from_jsonNrr   r   r   r   r   r     s   
	r   c                   @  sz   e Zd ZU dZdZded< dZded< dZded< dZded< dZ	ded< dZ
ded	< dZded
< dd Zedd ZdS )FontFamiliesz+
    Generic font families collection.
    Nr0   standardfixedserif
sans_serifcursivefantasy
pictographc                 C  s   t  }| jd ur| j|d< | jd ur.| j|d< | jd urB| j|d< | jd urV| j|d< | jd urj| j|d< | jd ur~| j|d< | jd ur| j|d< |S )Nr   r   r   	sansSerifr   r   r   )r<   r   r   r   r   r   r   r   r=   r   r   r   r   ;  s     













zFontFamilies.to_jsonc              
   C  s   | d|v rt |d nd d|v r,t |d nd d|v rBt |d nd d|v rXt |d nd d|v rnt |d nd d|v rt |d nd d|v rt |d nd dS )	Nr   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   M  s    zFontFamilies.from_json)r#   r$   r%   r&   r   r?   r   r   r   r   r   r   r   r'   r   r   r   r   r   r   !  s   
r   c                   @  s>   e Zd ZU dZdZded< dZded< dd Zedd	 Z	dS )
	FontSizesz
    Default font sizes.
    Ntyping.Optional[int]r   r   c                 C  s2   t  }| jd ur| j|d< | jd ur.| j|d< |S )Nr   r   )r<   r   r   r=   r   r   r   r   e  s    



zFontSizes.to_jsonc                 C  s4   | d|v rt |d nd d|v r,t |d nd dS )Nr   r   )r   r   r   r   r   r   r   r   m  s    zFontSizes.from_json)
r#   r$   r%   r&   r   r?   r   r   r'   r   r   r   r   r   r   Z  s   
r   c                   @  s@   e Zd ZdZdZdZdZdZdZdZ	dZ
d	d
 Zedd ZdS )ClientNavigationReasonZformSubmissionGetZformSubmissionPostZhttpHeaderRefreshZscriptInitiatedZmetaTagRefreshZpageBlockInterstitialrd   ZanchorClickc                 C  s   | j S r   rg   r   r   r   r   r     s    zClientNavigationReason.to_jsonc                 C  s   | |S r   r   r   r   r   r   r     s    z ClientNavigationReason.from_jsonN)r#   r$   r%   ZFORM_SUBMISSION_GETZFORM_SUBMISSION_POSTZHTTP_HEADER_REFRESHZSCRIPT_INITIATEDZMETA_TAG_REFRESHZPAGE_BLOCK_INTERSTITIALri   ZANCHOR_CLICKr   r'   r   r   r   r   r   r   u  s   r   c                   @  s0   e Zd ZdZdZdZdZdd Zedd Z	d	S )
ClientNavigationDispositionZ
currentTabZnewTabZ	newWindowdownloadc                 C  s   | j S r   rg   r   r   r   r   r     s    z#ClientNavigationDisposition.to_jsonc                 C  s   | |S r   r   r   r   r   r   r     s    z%ClientNavigationDisposition.from_jsonN)
r#   r$   r%   ZCURRENT_TABZNEW_TABZ
NEW_WINDOWZDOWNLOADr   r'   r   r   r   r   r   r     s   r   c                   @  s2   e Zd ZU ded< ded< dd Zedd ZdS )	InstallabilityErrorArgumentr   r2   rh   c                 C  s   t  }| j|d< | j|d< |S )Nr2   rh   )r<   r2   rh   r=   r   r   r   r     s    

z#InstallabilityErrorArgument.to_jsonc                 C  s   | t |d t |d dS )Nr2   rh   )r2   rh   r   r   r   r   r   r     s    

z%InstallabilityErrorArgument.from_jsonN)r#   r$   r%   r?   r   r'   r   r   r   r   r   r     s
   
r   c                   @  s6   e Zd ZU dZded< ded< dd Zedd	 Zd
S )InstallabilityErrorz"
    The installability error
    r   error_idz(typing.List[InstallabilityErrorArgument]error_argumentsc                 C  s(   t  }| j|d< dd | jD |d< |S )NerrorIdc                 S  s   g | ]}|  qS r   rS   rT   r   r   r   rW     rX   z/InstallabilityError.to_json.<locals>.<listcomp>errorArguments)r<   r   r   r=   r   r   r   r     s    
zInstallabilityError.to_jsonc                 C  s"   | t |d dd |d D dS )Nr   c                 S  s   g | ]}t |qS r   )r   r   rT   r   r   r   rW     rX   z1InstallabilityError.from_json.<locals>.<listcomp>r   )r   r   r   r   r   r   r   r     s    
zInstallabilityError.from_jsonNrr   r   r   r   r   r     s   
r   c                   @  sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
d Zedd ZdS )ReferrerPolicyz7
    The referring-policy used for the navigation.
    Z
noReferrerZnoReferrerWhenDowngradeoriginZoriginWhenCrossOriginZ
sameOriginZstrictOriginZstrictOriginWhenCrossOriginZ	unsafeUrlc                 C  s   | j S r   rg   r   r   r   r   r     s    zReferrerPolicy.to_jsonc                 C  s   | |S r   r   r   r   r   r   r     s    zReferrerPolicy.from_jsonN)r#   r$   r%   r&   ZNO_REFERRERZNO_REFERRER_WHEN_DOWNGRADEZORIGINZORIGIN_WHEN_CROSS_ORIGINZSAME_ORIGINZSTRICT_ORIGINZSTRICT_ORIGIN_WHEN_CROSS_ORIGINZ
UNSAFE_URLr   r'   r   r   r   r   r   r     s   r   r   z<typing.Generator[T_JSON_DICT, T_JSON_DICT, ScriptIdentifier])script_sourcer   c                 c  s,   t  }| |d< d|d}|V }t|d S )z
    Deprecated, please use addScriptToEvaluateOnNewDocument instead.

    **EXPERIMENTAL**

    :param script_source:
    :returns: Identifier of the added script.
    ZscriptSourcezPage.addScriptToEvaluateOnLoadmethodparams
identifierr<   r_   r   )r   r   cmd_dictr   r   r   r   add_script_to_evaluate_on_load  s    r   r0   )source
world_namer   c                 c  s<   t  }| |d< |dur||d< d|d}|V }t|d S )a  
    Evaluates given script in every frame upon creation (before loading frame's scripts).

    :param source:
    :param world_name: **(EXPERIMENTAL)** *(Optional)* If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.
    :returns: Identifier of the added script.
    r   N	worldNamez%Page.addScriptToEvaluateOnNewDocumentr   r   r   )r   r   r   r   r   r   r   r   &add_script_to_evaluate_on_new_document  s    r   z0typing.Generator[T_JSON_DICT, T_JSON_DICT, None]r   c                  c  s   ddi} | V }dS )z/
    Brings page to front (activates tab).
    r   zPage.bringToFrontNr   r   r   r   r   r   bring_to_front  s    r   r   ztyping.Optional[Viewport]rF   z/typing.Generator[T_JSON_DICT, T_JSON_DICT, str])format_qualityclipfrom_surfacer   c                 c  sf   t  }| dur| |d< |dur&||d< |dur:| |d< |durJ||d< d|d}|V }t|d S )	a  
    Capture page screenshot.

    :param format_: *(Optional)* Image compression format (defaults to png).
    :param quality: *(Optional)* Compression quality from range [0..100] (jpeg only).
    :param clip: *(Optional)* Capture the screenshot of a given region only.
    :param from_surface: **(EXPERIMENTAL)** *(Optional)* Capture the screenshot from the surface, rather than the view. Defaults to true.
    :returns: Base64-encoded image data.
    Nr   r   r   ZfromSurfacezPage.captureScreenshotr   data)r<   r   r   )r   r   r   r   r   r   r   r   r   r   capture_screenshot  s    r   )r   r   c                 c  s2   t  }| dur| |d< d|d}|V }t|d S )a"  
    Returns a snapshot of the page as a string. For MHTML format, the serialization includes
    iframes, shadow DOM, external resources, and element-inline styles.

    **EXPERIMENTAL**

    :param format_: *(Optional)* Format (defaults to mhtml).
    :returns: Serialized page data.
    Nr   zPage.captureSnapshotr   r   )r<   r   )r   r   r   r   r   r   r   capture_snapshot/  s    r   c                  c  s   ddi} | V }dS )zE
    Clears the overridden device metrics.

    **EXPERIMENTAL**
    r   zPage.clearDeviceMetricsOverrideNr   r   r   r   r   clear_device_metrics_overrideF  s    r   c                  c  s   ddi} | V }dS )zI
    Clears the overridden Device Orientation.

    **EXPERIMENTAL**
    r   z#Page.clearDeviceOrientationOverrideNr   r   r   r   r   !clear_device_orientation_overrideR  s    r   c                  c  s   ddi} | V }dS )z?
    Clears the overridden Geolocation Position and Error.
    r   zPage.clearGeolocationOverrideNr   r   r   r   r   clear_geolocation_override^  s    r   zFtyping.Generator[T_JSON_DICT, T_JSON_DICT, runtime.ExecutionContextId])frame_idr   grant_univeral_accessr   c                 c  sR   t  }|  |d< |dur"||d< |dur2||d< d|d}|V }tj|d S )a  
    Creates an isolated world for the given frame.

    :param frame_id: Id of the frame in which the isolated world should be created.
    :param world_name: *(Optional)* An optional name which is reported in the Execution Context.
    :param grant_univeral_access: *(Optional)* Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
    :returns: Execution context of the isolated world.
    frameIdNr   ZgrantUniveralAccesszPage.createIsolatedWorldr   ZexecutionContextId)r<   r   r   ZExecutionContextIdr   )r   r   r   r   r   r   r   r   r   create_isolated_worldh  s    r   )cookie_namer-   r   c                 c  s*   t  }| |d< ||d< d|d}|V }dS )z
    Deletes browser cookie with given name, domain and path.

    **EXPERIMENTAL**

    :param cookie_name: Name of the cookie to remove.
    :param url: URL to match cooke domain and path.
    Z
cookieNamer-   zPage.deleteCookier   Nr<   )r   r-   r   r   r   r   r   r   delete_cookie  s    r   c                  c  s   ddi} | V }dS )z-
    Disables page domain notifications.
    r   zPage.disableNr   r   r   r   r   disable  s    r   c                  c  s   ddi} | V }dS )z,
    Enables page domain notifications.
    r   zPage.enableNr   r   r   r   r   enable  s    r   ztyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, typing.List[AppManifestError], typing.Optional[str], typing.Optional[AppManifestParsedProperties]]]c                  c  sZ   ddi} | V }t |d dd |d D d|v r<t |d ndd	|v rTt|d	 ndfS )
z


    :returns: A tuple with the following items:

        0. **url** - Manifest location.
        1. **errors** - 
        2. **data** - *(Optional)* Manifest content.
        3. **parsed** - *(Optional)* Parsed manifest properties
    r   zPage.getAppManifestr-   c                 S  s   g | ]}t |qS r   )r   r   rT   r   r   r   rW     rX   z$get_app_manifest.<locals>.<listcomp>errorsr   Nparsed)r   r   r   r   r   r   r   get_app_manifest  s    
r   zLtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[InstallabilityError]]c                  c  s    ddi} | V }dd |d D S ),


    **EXPERIMENTAL**

    :returns: 
    r   zPage.getInstallabilityErrorsc                 S  s   g | ]}t |qS r   )r   r   rT   r   r   r   rW     rX   z-get_installability_errors.<locals>.<listcomp>ZinstallabilityErrorsr   r   r   r   r   get_installability_errors  s    	r   z@typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.Optional[str]]c                  c  s&   ddi} | V }d|v r"t |d S dS )r   r   zPage.getManifestIconsZprimaryIconNr   r   r   r   r   get_manifest_icons  s    	r   zGtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[network.Cookie]]c                  c  s    ddi} | V }dd |d D S )z
    Returns all browser cookies. Depending on the backend support, will return detailed cookie
    information in the ``cookies`` field.

    **EXPERIMENTAL**

    :returns: Array of cookie objects.
    r   zPage.getCookiesc                 S  s   g | ]}t j|qS r   )r   Cookier   rT   r   r   r   rW     rX   zget_cookies.<locals>.<listcomp>cookiesr   r   r   r   r   get_cookies  s    
r   z5typing.Generator[T_JSON_DICT, T_JSON_DICT, FrameTree]c                  c  s   ddi} | V }t |d S )z\
    Returns present frame tree structure.

    :returns: Present frame tree structure.
    r   zPage.getFrameTree	frameTreer^   r   r   r   r   get_frame_tree  s    r   zbtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[LayoutViewport, VisualViewport, dom.Rect]]c                  c  s8   ddi} | V }t |d t|d tj|d fS )aY  
    Returns metrics relating to the layouting of the page, such as viewport bounds/scale.

    :returns: A tuple with the following items:

        0. **layoutViewport** - Metrics relating to the layout viewport.
        1. **visualViewport** - Metrics relating to the visual viewport.
        2. **contentSize** - Size of scrollable area.
    r   zPage.getLayoutMetricsZlayoutViewportZvisualViewportrK   )r   r   r   r   ZRectr   r   r   r   get_layout_metrics  s    r   z[typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[int, typing.List[NavigationEntry]]]c                  c  s,   ddi} | V }t |d dd |d D fS )z
    Returns navigation history for the current page.

    :returns: A tuple with the following items:

        0. **currentIndex** - Index of the current navigation history entry.
        1. **entries** - Array of navigation history entries.
    r   zPage.getNavigationHistoryZcurrentIndexc                 S  s   g | ]}t |qS r   )rk   r   rT   r   r   r   rW   #  rX   z*get_navigation_history.<locals>.<listcomp>entriesr   r   r   r   r   get_navigation_history  s    

r   c                  c  s   ddi} | V }dS )z9
    Resets navigation history for the current page.
    r   zPage.resetNavigationHistoryNr   r   r   r   r   reset_navigation_history'  s    r   zCtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, bool]])r   r-   r   c                 c  sB   t  }|  |d< ||d< d|d}|V }t|d t|d fS )aT  
    Returns content of the given resource.

    **EXPERIMENTAL**

    :param frame_id: Frame id to get resource for.
    :param url: URL of the resource to get content for.
    :returns: A tuple with the following items:

        0. **content** - Resource content.
        1. **base64Encoded** - True, if content was served as base64.
    r   r-   zPage.getResourceContentr   contentZbase64Encoded)r<   r   r   rN   )r   r-   r   r   r   r   r   r   get_resource_content1  s    

r   z=typing.Generator[T_JSON_DICT, T_JSON_DICT, FrameResourceTree]c                  c  s   ddi} | V }t |d S )z
    Returns present frame / resource tree structure.

    **EXPERIMENTAL**

    :returns: Present frame / resource tree structure.
    r   zPage.getResourceTreer   rZ   r   r   r   r   get_resource_treeO  s    	r   rN   )acceptprompt_textr   c                 c  s2   t  }| |d< |dur||d< d|d}|V }dS )a,  
    Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).

    :param accept: Whether to accept or dismiss the dialog.
    :param prompt_text: *(Optional)* The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
    r   NZ
promptTextzPage.handleJavaScriptDialogr   r   )r   r   r   r   r   r   r   r   handle_java_script_dialog^  s    
r   ztyping.Optional[TransitionType]ztyping.Optional[FrameId]ztyping.Optional[ReferrerPolicy]zztyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[FrameId, typing.Optional[network.LoaderId], typing.Optional[str]]])r-   referrerro   r   referrer_policyr   c                 c  s   t  }| |d< |dur||d< |dur2| |d< |durF| |d< |durZ| |d< d|d}|V }t|d d	|v rtj|d	 ndd
|v rt|d
 ndfS )a  
    Navigates current page to the given URL.

    :param url: URL to navigate the page to.
    :param referrer: *(Optional)* Referrer URL.
    :param transition_type: *(Optional)* Intended transition type.
    :param frame_id: *(Optional)* Frame id to navigate, if not specified navigates the top frame.
    :param referrer_policy: **(EXPERIMENTAL)** *(Optional)* Referrer-policy used for the navigation.
    :returns: A tuple with the following items:

        0. **frameId** - Frame id that has navigated (or failed to navigate)
        1. **loaderId** - *(Optional)* Loader identifier.
        2. **errorText** - *(Optional)* User friendly error message, present if and only if navigation has failed.
    r-   Nr   rq   r   ZreferrerPolicyzPage.navigater   r6   Z	errorText)r<   r   r   r   r   r>   r   )r-   r   ro   r   r   r   r   r   r   r   r   navigates  s$    r   rl   )entry_idr   c                 c  s"   t  }| |d< d|d}|V }dS )zy
    Navigates current page to the given history entry.

    :param entry_id: Unique id of the entry to navigate to.
    ZentryIdzPage.navigateToHistoryEntryr   Nr   )r   r   r   r   r   r   r   navigate_to_history_entry  s    r   rD   z_typing.Generator[T_JSON_DICT, T_JSON_DICT, typing.Tuple[str, typing.Optional[io.StreamHandle]]])	landscapedisplay_header_footerprint_backgroundr   paper_widthpaper_height
margin_topmargin_bottommargin_leftmargin_rightpage_rangesignore_invalid_page_rangesheader_templatefooter_templateprefer_css_page_sizetransfer_moder   c                 c  sB  t  }| dur| |d< |dur&||d< |dur6||d< |durF||d< |durV||d< |durf||d< |durv||d< |dur||d	< |dur||d
< |	dur|	|d< |
dur|
|d< |dur||d< |dur||d< |dur||d< |dur||d< |dur||d< d|d}|V }t|d d|v r<tj|d ndfS )a  
    Print page as PDF.

    :param landscape: *(Optional)* Paper orientation. Defaults to false.
    :param display_header_footer: *(Optional)* Display header and footer. Defaults to false.
    :param print_background: *(Optional)* Print background graphics. Defaults to false.
    :param scale: *(Optional)* Scale of the webpage rendering. Defaults to 1.
    :param paper_width: *(Optional)* Paper width in inches. Defaults to 8.5 inches.
    :param paper_height: *(Optional)* Paper height in inches. Defaults to 11 inches.
    :param margin_top: *(Optional)* Top margin in inches. Defaults to 1cm (~0.4 inches).
    :param margin_bottom: *(Optional)* Bottom margin in inches. Defaults to 1cm (~0.4 inches).
    :param margin_left: *(Optional)* Left margin in inches. Defaults to 1cm (~0.4 inches).
    :param margin_right: *(Optional)* Right margin in inches. Defaults to 1cm (~0.4 inches).
    :param page_ranges: *(Optional)* Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
    :param ignore_invalid_page_ranges: *(Optional)* Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
    :param header_template: *(Optional)* HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - ```date````: formatted print date - ````title````: document title - ````url````: document location - ````pageNumber````: current page number - ````totalPages````: total pages in the document  For example, ````<span class=title></span>```` would generate span containing the title.
    :param footer_template: *(Optional)* HTML template for the print footer. Should use the same format as the ````headerTemplate````.
    :param prefer_css_page_size: *(Optional)* Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
    :param transfer_mode: **(EXPERIMENTAL)** *(Optional)* return as stream
    :returns: A tuple with the following items:

        0. **data** - Base64-encoded pdf data. Empty if `` returnAsStream` is specified.
        1. **stream** - *(Optional)* A handle of the stream that holds resulting PDF data.
    Nr   ZdisplayHeaderFooterZprintBackgroundr   Z
paperWidthZpaperHeightZ	marginTopZmarginBottomZ
marginLeftZmarginRightZ
pageRangesZignoreInvalidPageRangesZheaderTemplateZfooterTemplateZpreferCSSPageSizeZtransferModezPage.printToPDFr   r   stream)r<   r   r
   ZStreamHandler   )r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r   r   r   r   r   r   print_to_pdf  sP    *

r  )ignore_cachescript_to_evaluate_on_loadr   c                 c  s:   t  }| dur| |d< |dur&||d< d|d}|V }dS )an  
    Reloads given page optionally ignoring the cache.

    :param ignore_cache: *(Optional)* If true, browser cache is ignored (as if the user pressed Shift+refresh).
    :param script_to_evaluate_on_load: *(Optional)* If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.
    NZignoreCacheZscriptToEvaluateOnLoadzPage.reloadr   r   )r  r  r   r   r   r   r   r   rd     s    
rd   )r   r   c                 c  s&   t  }|  |d< d|d}|V }dS )z{
    Deprecated, please use removeScriptToEvaluateOnNewDocument instead.

    **EXPERIMENTAL**

    :param identifier:
    r   z!Page.removeScriptToEvaluateOnLoadr   Nr<   r   r   r   r   r   r   r   r   !remove_script_to_evaluate_on_load  s    
r
  c                 c  s&   t  }|  |d< d|d}|V }dS )zE
    Removes given script from the list.

    :param identifier:
    r   z(Page.removeScriptToEvaluateOnNewDocumentr   Nr  r	  r   r   r   )remove_script_to_evaluate_on_new_document.  s    r  )
session_idr   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Acknowledges that a screencast frame has been received by the frontend.

    **EXPERIMENTAL**

    :param session_id: Frame number.
    	sessionIdzPage.screencastFrameAckr   Nr   )r  r   r   r   r   r   r   screencast_frame_ack?  s    
r  zMtyping.Generator[T_JSON_DICT, T_JSON_DICT, typing.List[debugger.SearchMatch]])r   r-   querycase_sensitiveis_regexr   c                 c  sd   t  }|  |d< ||d< ||d< |dur2||d< |durB||d< d|d}|V }d	d
 |d D S )a  
    Searches for given string in resource content.

    **EXPERIMENTAL**

    :param frame_id: Frame id for resource to search in.
    :param url: URL of the resource to search in.
    :param query: String to search for.
    :param case_sensitive: *(Optional)* If true, search is case sensitive.
    :param is_regex: *(Optional)* If true, treats string parameter as regex.
    :returns: List of search matches.
    r   r-   r  NZcaseSensitiveZisRegexzPage.searchInResourcer   c                 S  s   g | ]}t j|qS r   )r   ZSearchMatchr   rT   r   r   r   rW   r  rX   z&search_in_resource.<locals>.<listcomp>resultr  )r   r-   r  r  r  r   r   r   r   r   r   search_in_resourceR  s    r  )enabledr   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Enable Chrome's experimental ad filter on all sites.

    **EXPERIMENTAL**

    :param enabled: Whether to block ads.
    r  zPage.setAdBlockingEnabledr   Nr   r  r   r   r   r   r   r   set_ad_blocking_enabledu  s    
r  c                 c  s"   t  }| |d< d|d}|V }dS )z
    Enable page Content Security Policy by-passing.

    **EXPERIMENTAL**

    :param enabled: Whether to bypass page CSP.
    r  zPage.setBypassCSPr   Nr   r  r   r   r   set_bypass_csp  s    
r  rM   z,typing.Optional[emulation.ScreenOrientation])r   r   device_scale_factormobiler   screen_widthscreen_height
position_x
position_ydont_set_visible_sizescreen_orientationviewportr   c                 c  s   t  }| |d< ||d< ||d< ||d< |dur6||d< |durF||d< |durV||d< |durf||d	< |durv||d
< |	dur|	|d< |
dur|
 |d< |dur| |d< d|d}|V }dS )a  
    Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
    window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
    query results).

    **EXPERIMENTAL**

    :param width: Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param height: Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
    :param device_scale_factor: Overriding device scale factor value. 0 disables the override.
    :param mobile: Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
    :param scale: *(Optional)* Scale to apply to resulting view image.
    :param screen_width: *(Optional)* Overriding screen width value in pixels (minimum 0, maximum 10000000).
    :param screen_height: *(Optional)* Overriding screen height value in pixels (minimum 0, maximum 10000000).
    :param position_x: *(Optional)* Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
    :param position_y: *(Optional)* Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
    :param dont_set_visible_size: *(Optional)* Do not set visible view size, rely upon explicit setVisibleSize call.
    :param screen_orientation: *(Optional)* Screen orientation override.
    :param viewport: *(Optional)* The viewport dimensions and scale. If not set, the override is cleared.
    r   r   ZdeviceScaleFactorr  Nr   ZscreenWidthZscreenHeightZ	positionXZ	positionYZdontSetVisibleSizeZscreenOrientationr   zPage.setDeviceMetricsOverrider   r  )r   r   r  r  r   r  r  r  r  r  r  r   r   r   r   r   r   r   set_device_metrics_override  s2    "r!  )alphabetagammar   c                 c  s2   t  }| |d< ||d< ||d< d|d}|V }dS )z
    Overrides the Device Orientation.

    **EXPERIMENTAL**

    :param alpha: Mock alpha
    :param beta: Mock beta
    :param gamma: Mock gamma
    r"  r#  r$  z!Page.setDeviceOrientationOverrider   Nr   )r"  r#  r$  r   r   r   r   r   r   set_device_orientation_override  s    r%  )font_familiesr   c                 c  s&   t  }|  |d< d|d}|V }dS )z
    Set generic font families.

    **EXPERIMENTAL**

    :param font_families: Specifies font families to set. If a font family is not specified, it won't be changed.
    ZfontFamilieszPage.setFontFamiliesr   Nr  )r&  r   r   r   r   r   r   set_font_families  s    
r'  )
font_sizesr   c                 c  s&   t  }|  |d< d|d}|V }dS )z
    Set default font sizes.

    **EXPERIMENTAL**

    :param font_sizes: Specifies font sizes to set. If a font size is not specified, it won't be changed.
    Z	fontSizeszPage.setFontSizesr   Nr  )r(  r   r   r   r   r   r   set_font_sizes  s    
r)  )r   htmlr   c                 c  s.   t  }|  |d< ||d< d|d}|V }dS )z
    Sets given markup as the document's HTML.

    :param frame_id: Frame id to set HTML for.
    :param html: HTML content to set.
    r   r*  zPage.setDocumentContentr   Nr  )r   r*  r   r   r   r   r   r   set_document_content  s    
r+  )behaviordownload_pathr   c                 c  s2   t  }| |d< |dur||d< d|d}|V }dS )aT  
    Set the behavior when downloading a file.

    **EXPERIMENTAL**

    :param behavior: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny).
    :param download_path: *(Optional)* The default path to save downloaded files to. This is requred if behavior is set to 'allow'
    r,  NZdownloadPathzPage.setDownloadBehaviorr   r   )r,  r-  r   r   r   r   r   r   set_download_behavior,  s    r.  )latitude	longitudeaccuracyr   c                 c  sJ   t  }| dur| |d< |dur&||d< |dur6||d< d|d}|V }dS )a  
    Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
    unavailable.

    :param latitude: *(Optional)* Mock latitude
    :param longitude: *(Optional)* Mock longitude
    :param accuracy: *(Optional)* Mock accuracy
    Nr/  r0  r1  zPage.setGeolocationOverrider   r   )r/  r0  r1  r   r   r   r   r   r   set_geolocation_overrideC  s    r2  c                 c  s"   t  }| |d< d|d}|V }dS )z
    Controls whether page will emit lifecycle events.

    **EXPERIMENTAL**

    :param enabled: If true, starts emitting lifecycle events.
    r  zPage.setLifecycleEventsEnabledr   Nr   r  r   r   r   set_lifecycle_events_enabled^  s    
r3  )r  configurationr   c                 c  s2   t  }| |d< |dur||d< d|d}|V }dS )a   
    Toggles mouse event-based touch event emulation.

    **EXPERIMENTAL**

    :param enabled: Whether the touch event emulation should be enabled.
    :param configuration: *(Optional)* Touch/gesture events configuration. Default: current platform.
    r  Nr4  zPage.setTouchEmulationEnabledr   r   )r  r4  r   r   r   r   r   r   set_touch_emulation_enabledq  s    r5  )r   r   	max_width
max_heightevery_nth_framer   c                 c  sj   t  }| dur| |d< |dur&||d< |dur6||d< |durF||d< |durV||d< d|d}|V }dS )	a  
    Starts sending each frame using the ``screencastFrame`` event.

    **EXPERIMENTAL**

    :param format_: *(Optional)* Image compression format.
    :param quality: *(Optional)* Compression quality from range [0..100].
    :param max_width: *(Optional)* Maximum screenshot width.
    :param max_height: *(Optional)* Maximum screenshot height.
    :param every_nth_frame: *(Optional)* Send every n-th frame.
    Nr   r   ZmaxWidthZ	maxHeightZeveryNthFramezPage.startScreencastr   r   )r   r   r6  r7  r8  r   r   r   r   r   r   start_screencast  s    r9  c                  c  s   ddi} | V }dS )zK
    Force the page stop all navigations and pending resource fetches.
    r   zPage.stopLoadingNr   r   r   r   r   stop_loading  s    r:  c                  c  s   ddi} | V }dS )zW
    Crashes renderer on the IO thread, generates minidumps.

    **EXPERIMENTAL**
    r   z
Page.crashNr   r   r   r   r   crash  s    r;  c                  c  s   ddi} | V }dS )z\
    Tries to close page, running its beforeunload hooks, if any.

    **EXPERIMENTAL**
    r   z
Page.closeNr   r   r   r   r   close  s    r<  )stater   c                 c  s"   t  }| |d< d|d}|V }dS )z
    Tries to update the web lifecycle state of the page.
    It will transition the page to the given state according to:
    https://github.com/WICG/web-lifecycle/

    **EXPERIMENTAL**

    :param state: Target lifecycle state
    r=  zPage.setWebLifecycleStater   Nr   )r=  r   r   r   r   r   r   set_web_lifecycle_state  s    r>  c                  c  s   ddi} | V }dS )zT
    Stops sending each frame in the ``screencastFrame``.

    **EXPERIMENTAL**
    r   zPage.stopScreencastNr   r   r   r   r   stop_screencast  s    r?  c                 c  s"   t  }| |d< d|d}|V }dS )z{
    Forces compilation cache to be generated for every subresource script.

    **EXPERIMENTAL**

    :param enabled:
    r  zPage.setProduceCompilationCacher   Nr   r  r   r   r   set_produce_compilation_cache  s    
r@  )r-   r   r   c                 c  s*   t  }| |d< ||d< d|d}|V }dS )z
    Seeds compilation cache for given url. Compilation cache does not survive
    cross-process navigation.

    **EXPERIMENTAL**

    :param url:
    :param data: Base64-encoded data
    r-   r   zPage.addCompilationCacher   Nr   )r-   r   r   r   r   r   r   r   add_compilation_cache  s    rA  c                  c  s   ddi} | V }dS )z@
    Clears seeded compilation cache.

    **EXPERIMENTAL**
    r   zPage.clearCompilationCacheNr   r   r   r   r   clear_compilation_cache  s    rB  )r   groupr   c                 c  s2   t  }| |d< |dur||d< d|d}|V }dS )z
    Generates a report for testing.

    **EXPERIMENTAL**

    :param message: Message to be displayed in the report.
    :param group: *(Optional)* Specifies the endpoint group to deliver the report to.
    r   NrC  zPage.generateTestReportr   r   )r   rC  r   r   r   r   r   r   generate_test_report%  s    rD  c                  c  s   ddi} | V }dS )zt
    Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger.

    **EXPERIMENTAL**
    r   zPage.waitForDebuggerNr   r   r   r   r   wait_for_debugger<  s    rE  c                 c  s"   t  }| |d< d|d}|V }dS )a  
    Intercept file chooser requests and transfer control to protocol clients.
    When file chooser interception is enabled, native file chooser dialog is not shown.
    Instead, a protocol event ``Page.fileChooserOpened`` is emitted.

    **EXPERIMENTAL**

    :param enabled:
    r  z"Page.setInterceptFileChooserDialogr   Nr   r  r   r   r   !set_intercept_file_chooser_dialogH  s    rF  zPage.domContentEventFiredc                   @  s*   e Zd ZU ded< edd dddZdS )DomContentEventFirednetwork.MonotonicTimerz   r   r   c                 C  s   | t j|d dS Nrz   )rz   r   MonotonicTimer   r   r   r   r   r   b  s    zDomContentEventFired.from_jsonNr#   r$   r%   r?   r'   r   r   r   r   r   rG  ]  s   
rG  zPage.fileChooserOpenedc                   @  s>   e Zd ZU dZded< ded< ded< edd d	d
dZdS )FileChooserOpenedzE
    Emitted only when ``page.interceptFileChooser`` is enabled.
    r   r   zdom.BackendNodeIdbackend_node_idr   moder   r   c                 C  s,   | t |d tj|d t|d dS )Nr   ZbackendNodeIdrO  )r   rN  rO  )r   r   r   ZBackendNodeIdr   r   r   r   r   r   v  s
    
zFileChooserOpened.from_jsonNr#   r$   r%   r&   r?   r'   r   r   r   r   r   rM  i  s   
rM  zPage.frameAttachedc                   @  s>   e Zd ZU dZded< ded< ded< edd dd	d
ZdS )FrameAttachedz;
    Fired when frame has been attached to its parent.
    r   r   parent_frame_idz#typing.Optional[runtime.StackTrace]stackr   r   c                 C  s:   | t |d t |d d|v r2tj|d nd dS )Nr   ZparentFrameIdrS  )r   rR  rS  )r   r   r   Z
StackTracer   r   r   r   r     s
    zFrameAttached.from_jsonNrP  r   r   r   r   rQ    s   
rQ  z$Page.frameClearedScheduledNavigationc                   @  s.   e Zd ZU dZded< edd dddZdS )	FrameClearedScheduledNavigationz@
    Fired when frame no longer has a scheduled navigation.
    r   r   r   r   c                 C  s   | t |d dS Nr   )r   r   r   r   r   r   r   r     s    z)FrameClearedScheduledNavigation.from_jsonNrP  r   r   r   r   rT    s   
rT  zPage.frameDetachedc                   @  s.   e Zd ZU dZded< edd dddZdS )	FrameDetachedz=
    Fired when frame has been detached from its parent.
    r   r   r   r   c                 C  s   | t |d dS rU  rV  r   r   r   r   r     s    zFrameDetached.from_jsonNrP  r   r   r   r   rW    s   
rW  zPage.frameNavigatedc                   @  s.   e Zd ZU dZded< edd dddZdS )	FrameNavigatedzh
    Fired once navigation of the frame has completed. Frame is now associated with the new loader.
    r)   rP   r   r   c                 C  s   | t |d dS )NrP   )rP   r[   r   r   r   r   r     s    zFrameNavigated.from_jsonNrP  r   r   r   r   rX    s   
rX  zPage.frameResizedc                   @  s$   e Zd ZdZedd dddZdS )FrameResizedz
    **EXPERIMENTAL**


    r   r   c                 C  s   |  S r   r   r   r   r   r   r     s    zFrameResized.from_jsonNr#   r$   r%   r&   r'   r   r   r   r   r   rY    s   rY  zPage.frameRequestedNavigationc                   @  sF   e Zd ZU dZded< ded< ded< ded	< ed
d dddZdS )FrameRequestedNavigationz
    **EXPERIMENTAL**

    Fired when a renderer-initiated navigation is requested.
    Navigation may still be cancelled after the event is issued.
    r   r   r   reasonr   r-   r   dispositionr   r   c                 C  s6   | t |d t|d t|d t|d dS )Nr   r\  r-   r]  )r   r\  r-   r]  )r   r   r   r   r   r   r   r   r   r     s    
z"FrameRequestedNavigation.from_jsonNrP  r   r   r   r   r[    s   
r[  zPage.frameScheduledNavigationc                   @  sF   e Zd ZU dZded< ded< ded< ded	< ed
d dddZdS )FrameScheduledNavigationz<
    Fired when frame schedules a potential navigation.
    r   r   rM   delayr   r\  r   r-   r   r   c                 C  s4   | t |d t|d t|d t|d dS )Nr   r_  r\  r-   )r   r_  r\  r-   )r   r   rM   r   r   r   r   r   r   r     s    

z"FrameScheduledNavigation.from_jsonNrP  r   r   r   r   r^    s   
r^  zPage.frameStartedLoadingc                   @  s.   e Zd ZU dZded< edd dddZdS )	FrameStartedLoadingzE
    **EXPERIMENTAL**

    Fired when frame has started loading.
    r   r   r   r   c                 C  s   | t |d dS rU  rV  r   r   r   r   r     s    zFrameStartedLoading.from_jsonNrP  r   r   r   r   r`    s   
r`  zPage.frameStoppedLoadingc                   @  s.   e Zd ZU dZded< edd dddZdS )	FrameStoppedLoadingzE
    **EXPERIMENTAL**

    Fired when frame has stopped loading.
    r   r   r   r   c                 C  s   | t |d dS rU  rV  r   r   r   r   r   )  s    zFrameStoppedLoading.from_jsonNrP  r   r   r   r   ra    s   
ra  zPage.downloadWillBeginc                   @  sF   e Zd ZU dZded< ded< ded< ded< edd d	d
dZdS )DownloadWillBeginzM
    **EXPERIMENTAL**

    Fired when page is about to start a download.
    r   r   r   guidr-   suggested_filenamer   r   c                 C  s2   | t |d t|d t|d t|d dS )Nr   rc  r-   ZsuggestedFilename)r   rc  r-   rd  r   r   r   r   r   r   r   r   A  s    


zDownloadWillBegin.from_jsonNrP  r   r   r   r   rb  0  s   
rb  zPage.downloadProgressc                   @  sF   e Zd ZU dZded< ded< ded< ded< edd d	d
dZdS )DownloadProgresszc
    **EXPERIMENTAL**

    Fired when download makes progress. Last call has ``done`` == true.
    r   rc  rM   total_bytesreceived_bytesr=  r   r   c                 C  s0   | t |d t|d t|d t |d dS )Nrc  Z
totalBytesZreceivedBytesr=  )rc  rg  rh  r=  )r   rM   r   r   r   r   r   \  s    



zDownloadProgress.from_jsonNrP  r   r   r   r   rf  K  s   
rf  zPage.interstitialHiddenc                   @  s$   e Zd ZdZedd dddZdS )InterstitialHiddenz1
    Fired when interstitial page was hidden
    r   r   c                 C  s   |  S r   r   r   r   r   r   r   n  s    zInterstitialHidden.from_jsonNrZ  r   r   r   r   ri  f  s   ri  zPage.interstitialShownc                   @  s$   e Zd ZdZedd dddZdS )InterstitialShownz0
    Fired when interstitial page was shown
    r   r   c                 C  s   |  S r   r   r   r   r   r   r   }  s    zInterstitialShown.from_jsonNrZ  r   r   r   r   rj  u  s   rj  zPage.javascriptDialogClosedc                   @  s6   e Zd ZU dZded< ded< edd ddd	Zd
S )JavascriptDialogClosedzs
    Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been
    closed.
    rN   r  r   
user_inputr   r   c                 C  s   | t |d t|d dS )Nr  Z	userInput)r  rl  )rN   r   r   r   r   r   r     s    

z JavascriptDialogClosed.from_jsonNrP  r   r   r   r   rk    s
   
rk  zPage.javascriptDialogOpeningc                   @  sN   e Zd ZU dZded< ded< ded< ded< d	ed
< edd dddZdS )JavascriptDialogOpeningzt
    Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to
    open.
    r   r-   r   r   rA   rN   has_browser_handlerr0   default_promptr   r   c                 C  sH   | t |d t |d t|d t|d d|v r@t |d nd dS )Nr-   r   rI   ZhasBrowserHandlerZdefaultPrompt)r-   r   rA   rn  ro  )r   r   r   rN   r   r   r   r   r     s    


z!JavascriptDialogOpening.from_jsonNrP  r   r   r   r   rm    s   
rm  zPage.lifecycleEventc                   @  sF   e Zd ZU dZded< ded< ded< ded	< ed
d dddZdS )LifecycleEventzY
    Fired for top level page lifecycle events such as navigation, load, paint, etc.
    r   r   r+   r,   r   r2   rH  rz   r   r   c                 C  s:   | t |d tj|d t|d tj|d dS )Nr   r6   r2   rz   )r   r,   r2   rz   )r   r   r   r>   r   rK  r   r   r   r   r     s    
zLifecycleEvent.from_jsonNrP  r   r   r   r   rp    s   
rp  zPage.loadEventFiredc                   @  s*   e Zd ZU ded< edd dddZdS )LoadEventFiredrH  rz   r   r   c                 C  s   | t j|d dS rI  rJ  r   r   r   r   r     s    zLoadEventFired.from_jsonNrL  r   r   r   r   rq    s   
rq  zPage.navigatedWithinDocumentc                   @  s6   e Zd ZU dZded< ded< edd ddd	Zd
S )NavigatedWithinDocumentz
    **EXPERIMENTAL**

    Fired when same-document navigation happens, e.g. due to history API usage or anchor navigation.
    r   r   r   r-   r   r   c                 C  s   | t |d t|d dS )Nr   r-   )r   r-   re  r   r   r   r   r     s    
z!NavigatedWithinDocument.from_jsonNrP  r   r   r   r   rr    s
   
rr  zPage.screencastFramec                   @  s>   e Zd ZU dZded< ded< ded< edd d	d
dZdS )ScreencastFramez[
    **EXPERIMENTAL**

    Compressed image data requested by the ``startScreencast``.
    r   r   rs   metadatarl   r  r   r   c                 C  s(   | t |d t|d t|d dS )Nr   rt  r  )r   rt  r  )r   rs   r   rl   r   r   r   r   r     s
    

zScreencastFrame.from_jsonNrP  r   r   r   r   rs    s   
rs  z Page.screencastVisibilityChangedc                   @  s.   e Zd ZU dZded< edd dddZdS )	ScreencastVisibilityChangedzk
    **EXPERIMENTAL**

    Fired when the page with currently enabled screencast was shown or hidden .
    rN   visibler   r   c                 C  s   | t |d dS )Nrv  )rv  )rN   r   r   r   r   r   	  s    
z%ScreencastVisibilityChanged.from_jsonNrP  r   r   r   r   ru  	  s   
ru  zPage.windowOpenc                   @  sF   e Zd ZU dZded< ded< ded< ded< ed	d d
ddZdS )
WindowOpenzq
    Fired when a new window is going to be opened, via window.open(), link click, form submission,
    etc.
    r   r-   window_nameztyping.List[str]window_featuresrN   user_gesturer   r   c                 C  s6   | t |d t |d dd |d D t|d dS )Nr-   Z
windowNamec                 S  s   g | ]}t |qS r   r   rT   r   r   r   rW   .	  rX   z(WindowOpen.from_json.<locals>.<listcomp>ZwindowFeaturesZuserGesture)r-   rx  ry  rz  )r   rN   r   r   r   r   r   )	  s    


zWindowOpen.from_jsonNrP  r   r   r   r   rw  	  s   
rw  zPage.compilationCacheProducedc                   @  s6   e Zd ZU dZded< ded< edd dddZd	S )
CompilationCacheProducedz
    **EXPERIMENTAL**

    Issued for every compilation cache generated. Is only available
    if Page.setGenerateCompilationCache is enabled.
    r   r-   r   r   r   c                 C  s   | t |d t |d dS )Nr-   r   )r-   r   r   r   r   r   r   r   @	  s    

z"CompilationCacheProduced.from_jsonNrP  r   r   r   r   r{  3	  s
   
r{  )N)NNNN)N)NN)N)NNNN)NNNNNNNNNNNNNNNN)NN)NN)NNNNNNNN)N)NNN)N)NNNNN)N)v
__future__r   utilr   r   Zdataclassesr   enumtyping r   r   r	   r
   r   r   r   r   r)   r@   rO   r]   r_   Enumr`   rk   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  rd   r
  r  r  r  r  r  r!  r%  r'  r)  r+  r.  r2  r3  r5  r9  r:  r;  r<  r>  r?  r@  rA  rB  rD  rE  rF  rG  rM  rQ  rT  rW  rX  rY  r[  r^  r`  ra  rb  rf  ri  rj  rk  rm  rp  rq  rr  rs  ru  rw  r{  r   r   r   r   <module>   s  ?5'2""7'8   ! 


   +               0W  #       (>      $


