
    ^j7
                     J    d dl mZmZmZmZ d dlmZ ddlmZ	  G d de      Z
y)    )AnyDictOptionalUnion)CanExecuteCommands   )MobileCommandc            	       4    e Zd Zddededee   defdZd	dZy)
ExecuteDriverNscriptscript_type
timeout_msreturnc                      G d d      }||d}|||d<   | j                  t        j                  |      d   } ||      S )a>  Run a set of script against the current session, allowing execution of many commands in one Appium request.
        Please read http://appium.io/docs/en/commands/session/execute-driver for more details about the acceptable
        scripts and the output format.

        Args:
            script: The string consisting of the script itself
            script_type: The name of the script type. Defaults to 'webdriverio'.
            timeout_ms: The number of `ms` Appium should wait for the script to finish before
             killing it due to timeout_ms.

        Usage:
            | self.driver.execute_driver(script='return [];')
            | self.driver.execute_driver(script='return [];', script_type='webdriverio')
            | self.driver.execute_driver(script='return [];', script_type='webdriverio', timeout_ms=10000)

        Returns:
            ExecuteDriver.Result: The result of the script. It has 'result' and 'logs' keys.

        Raises:
            WebDriverException: If something error happens in the script. The message has the original error message.
        c                       e Zd ZdefdZy),ExecuteDriver.execute_driver.<locals>.Resultresc                 ,    |d   | _         |d   | _        y )Nresultlogs)r   r   )selfr   s     ^/home/ubuntu/.local/lib/python3.12/site-packages/appium/webdriver/extensions/execute_driver.py__init__z5ExecuteDriver.execute_driver.<locals>.Result.__init__0   s    !(mK	    N)__name__
__module____qualname__r   r    r   r   Resultr   /   s    (D (r   r   )r   typetimeoutvalue)executeCommandEXECUTE_DRIVER)r   r   r   r   r   optionresponses          r   execute_driverzExecuteDriver.execute_driver   sN    .	( 	(
 9?-T! *F9<< 6 6?Hhr   c                 Z    | j                   j                  t        j                  dd       y )NPOSTz)/session/$sessionId/appium/execute_driver)command_executoradd_commandr$   r%   )r   s    r   _add_commandszExecuteDriver._add_commands;   s!    ))'*@*@&Juvr   )webdriverioN)r   N)	r   r   r   strr   intr   r(   r-   r   r   r   r   r      s2    ! S ! s ! X`adXe ! qt ! Fwr   r   N)typingr   r   r   r   /appium.protocols.webdriver.can_execute_commandsr   mobilecommandr	   r$   r   r   r   r   <module>r4      s"    . - N 4&w& &wr   