
    >i                         d dl mZ d dlmZmZ d dlmZmZmZm	Z	m
Z
mZmZ d dlmZ erd dlmZmZmZmZmZmZmZmZ d dlmZ  G d d      Zy	)
    )annotations)TYPE_CHECKINGOptional)AccessibilityMethodGetAXNodeAndAncestorsParamsGetChildAXNodesParamsGetFullAXTreeParamsGetPartialAXTreeParamsGetRootAXNodeParamsQueryAXTreeParams)Command)DisableCommandEnableCommandGetAXNodeAndAncestorsCommandGetChildAXNodesCommandGetFullAXTreeCommandGetPartialAXTreeCommandGetRootAXNodeCommandQueryAXTreeCommand)AXNodeIdc                     e Zd ZdZedd       Zedd       Ze	 	 	 	 d	 	 	 	 	 	 	 	 	 dd       Ze	 	 d	 	 	 	 	 dd       Ze	 d	 	 	 dd       Z	e	 	 	 d	 	 	 	 	 	 	 dd       Z
e	 d	 	 	 	 	 dd	       Ze	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd
       Zy)AccessibilityCommandsa4  
    Implementation of Chrome DevTools Protocol for the Accessibility domain.

    This class provides commands for interacting with the accessibility tree,
    enabling inspection and querying of accessible nodes on a page.

    See https://chromedevtools.github.io/devtools-protocol/tot/Accessibility/
    c                 6    t        t        j                        S )z
        Disables the accessibility domain.

        Returns:
            DisableCommand: CDP command to disable the accessibility domain.
        method)r   r   DISABLE     l/var/www/python/tenders/Scrapper/venv/lib/python3.12/site-packages/pydoll/commands/accessibility_commands.pydisablezAccessibilityCommands.disable(   s     199::r   c                 6    t        t        j                        S )z
        Enables the accessibility domain which causes AXNodeIds to remain
        consistent between method calls.

        Returns:
            EnableCommand: CDP command to enable the accessibility domain.
        r   )r   r   ENABLEr   r   r   enablezAccessibilityCommands.enable2   s     18899r   Nc                    t               }| | |d<   |||d<   |||d<   |||d<   t        t        j                  |      S )a  
        Fetches the accessibility node and partial accessibility tree for this
        DOM node, if it exists.

        Args:
            node_id: Identifier of the node to get the partial accessibility
                tree for.
            backend_node_id: Identifier of the backend node to get the partial
                accessibility tree for.
            object_id: JavaScript object id of the node wrapper to get the
                partial accessibility tree for.
            fetch_relatives: Whether to fetch this node's ancestors, siblings
                and children. Defaults to True.

        Returns:
            GetPartialAXTreeCommand: CDP command to get the partial AX tree.
        nodeIdbackendNodeIdobjectIdfetchRelativesr   params)r
   r   r   GET_PARTIAL_AX_TREE)node_idbackend_node_id	object_idfetch_relativesr*   s        r   get_partial_ax_treez)AccessibilityCommands.get_partial_ax_tree=   sa    0 ()&F8&&5F?# !*F:&'6F#$1EEfUUr   c                h    t               }| | |d<   |||d<   t        t        j                  |      S )a  
        Fetches the entire accessibility tree for the root Document.

        Args:
            depth: The maximum depth at which descendants of the root node
                should be retrieved. If omitted, the full tree is returned.
            frame_id: The frame for whose document the AX tree should be
                retrieved. If omitted, the root frame is used.

        Returns:
            GetFullAXTreeCommand: CDP command to get the full AX tree.
        depthframeIdr)   )r	   r   r   GET_FULL_AX_TREE)r2   frame_idr*   s      r   get_full_ax_treez&AccessibilityCommands.get_full_ax_tree`   s?    " %&#F7O (F91BB6RRr   c                Z    t               }| | |d<   t        t        j                  |      S )a1  
        Fetches the root node of the accessibility tree for a Document.

        Args:
            frame_id: The frame in whose document the node resides. If omitted,
                the root frame is used.

        Returns:
            GetRootAXNodeCommand: CDP command to get the root AX node.
        r3   r)   )r   r   r   GET_ROOT_AX_NODE)r5   r*   s     r   get_root_ax_nodez&AccessibilityCommands.get_root_ax_nodex   s0     %& (F91BB6RRr   c                v    t               }| | |d<   |||d<   |||d<   t        t        j                  |      S )a  
        Fetches a node and all ancestors up to and including the root.

        Args:
            node_id: Identifier of the node to get ancestors for.
            backend_node_id: Identifier of the backend node to get ancestors for.
            object_id: JavaScript object id of the node wrapper to get
                ancestors for.

        Returns:
            GetAXNodeAndAncestorsCommand: CDP command to get a node and its ancestors.
        r%   r&   r'   r)   )r   r   r   GET_AX_NODE_AND_ANCESTORS)r,   r-   r.   r*   s       r   get_ax_node_and_ancestorsz/AccessibilityCommands.get_ax_node_and_ancestors   sQ    $ -.&F8&&5F?# !*F:1KKTZ[[r   c                ^    t        |       }|||d<   t        t        j                  |      S )as  
        Fetches a particular accessibility node by AXNodeId.

        Args:
            id: The AXNodeId of the node whose children should be retrieved.
            frame_id: The frame in whose document the node resides. If omitted,
                the root frame is used.

        Returns:
            GetChildAXNodesCommand: CDP command to get child AX nodes.
        )idr3   r)   )r   r   r   GET_CHILD_AX_NODES)r>   r5   r*   s      r   get_child_ax_nodesz(AccessibilityCommands.get_child_ax_nodes   s2      '"- (F91DDVTTr   c                    t               }| | |d<   |||d<   |||d<   |||d<   |||d<   t        t        j                  |      S )a  
        Queries the accessibility tree for a DOM subtree for nodes with a
        given name and/or role.

        Args:
            node_id: Identifier of the node for the root of the subtree to
                search in.
            backend_node_id: Identifier of the backend node for the root of
                the subtree to search in.
            object_id: JavaScript object id of the node wrapper for the root
                of the subtree to search in.
            accessible_name: Find nodes with this computed name.
            role: Find nodes with this computed role.

        Returns:
            QueryAXTreeCommand: CDP command to query the AX tree.
        r%   r&   r'   accessibleNameroler)   )r   r   r   QUERY_AX_TREE)r,   r-   r.   accessible_namerC   r*   s         r   query_ax_treez#AccessibilityCommands.query_ax_tree   sp    2 #$&F8&&5F?# !*F:&'6F#$!F6N1??OOr   )returnr   )rG   r   )NNNN)
r,   Optional[int]r-   rH   r.   Optional[str]r/   zOptional[bool]rG   r   )NN)r2   rH   r5   rI   rG   r   )N)r5   rI   rG   r   )NNN)r,   rH   r-   rH   r.   rI   rG   r   )r>   r   r5   rI   rG   r   )NNNNN)r,   rH   r-   rH   r.   rI   rE   rI   rC   rI   rG   r   )__name__
__module____qualname____doc__staticmethodr    r#   r0   r6   r9   r<   r@   rF   r   r   r   r   r      s    ; ; : : !%)-#'*.	 V V& V ! V (	 V
 
! V  VD #"&SSS 
S S. "&SS	S S$ !%)-#'\\&\ !\ 
&	\ \4  #'UUU 
 U U( !%)-#')-"#P#P&#P !#P '	#P
 #P 
#P #Pr   r   N)
__future__r   typingr   r   %pydoll.protocol.accessibility.methodsr   r   r   r	   r
   r   r   pydoll.protocol.baser   r   r   r   r   r   r   r   r   #pydoll.protocol.accessibility.typesr   r   r   r   r   <module>rT      sD    " *   )	 	 	 =AP APr   