
    i                         S SK JrJrJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJr  S S	KJr   " S
 S5      rg)    )AnyOptionalUnion)interaction)
KeyActions)KeyInput)PointerActions)PointerInput)WheelActions)
WheelInput)Commandc                   ^   \ rS rSr    SS\\   S\\   S\\   S\SS4
S jjr	S	\
S\\S
      4S jr\S\\   4S j5       r\S\\   4S j5       r\S\4S j5       r\S\4S j5       r\S\4S j5       rS	\
S\4S jrS\
S	\
S\4S jrS	\
S\4S jrSS jrSS jrS\\\\4   SS4S jrSrg)ActionBuilder   Nmousewheelkeyboarddurationreturnc                 L   U=(       d    [        [        R                  S5      nU=(       d    [        [        R                  5      nU=(       d    [        [        R                  5      nX$U/U l        [        U5      U l	        [        X%S9U l        [        U5      U l        Xl        g )Nr   )r   )r
   r   POINTER_MOUSEr   KEYr   WHEELdevicesr   _key_actionr	   _pointer_actionr   _wheel_actiondriver)selfr   r   r   r   r   s         ]C:\des-py\RoboSAPF\venv\Lib\site-packages\selenium\webdriver\common\actions\action_builder.py__init__ActionBuilder.__init__    s|     Ik&?&?I8x86K$5$56INZ_H`%h/-eG)%0    name)r   r
   r   c                 L   ^ [        [        U4S jU R                  5      S5      $ )zGet the device with the given name.

Parameters:
-----------
name : str
    The name of the device to get.

Returns:
--------
Optional[Union[WheelInput, PointerInput, KeyInput]] : The device with the given name.
c                    > U T:H  $ N )xr$   s    r    <lambda>/ActionBuilder.get_device_with.<locals>.<lambda>=   s	    Q$Yr#   N)nextfilterr   )r   r$   s    `r    get_device_withActionBuilder.get_device_with1   s     F.=tDDr#   c                 t    U R                    Vs/ s H  n[        U[        5      (       d  M  UPM     sn$ s  snf r'   )r   
isinstancer
   r   devices     r    pointer_inputsActionBuilder.pointer_inputs?   s'    %)\\V\6Z5U\VVV   55c                 t    U R                    Vs/ s H  n[        U[        5      (       d  M  UPM     sn$ s  snf r'   )r   r1   r   r2   s     r    
key_inputsActionBuilder.key_inputsC   s'    %)\\R\6Z5Q\RRRr6   c                     U R                   $ r'   )r   r   s    r    
key_actionActionBuilder.key_actionG   s    r#   c                     U R                   $ r'   )r   r;   s    r    pointer_actionActionBuilder.pointer_actionK   s    ###r#   c                     U R                   $ r'   )r   r;   s    r    wheel_actionActionBuilder.wheel_actionO   s    !!!r#   c                 >    [        U5      nU R                  U5        U$ )a/  Add a new key input device to the action builder.

Parameters:
-----------
name : str
    The name of the key input device.

Returns:
--------
KeyInput : The newly created key input device.

Example:
--------
>>> action_builder = ActionBuilder(driver)
>>> action_builder.add_key_input(name="keyboard2")
)r   
_add_inputr   r$   	new_inputs      r    add_key_inputActionBuilder.add_key_inputS   s    " TN		"r#   kindc                 >    [        X5      nU R                  U5        U$ )a  Add a new pointer input device to the action builder.

Parameters:
-----------
kind : str
    The kind of pointer input device.
        - "mouse"
        - "touch"
        - "pen"

name : str
    The name of the pointer input device.

Returns:
--------
PointerInput : The newly created pointer input device.

Example:
--------
>>> action_builder = ActionBuilder(driver)
>>> action_builder.add_pointer_input(kind="mouse", name="mouse")
)r
   rE   )r   rJ   r$   rG   s       r    add_pointer_inputActionBuilder.add_pointer_inputh   s     . !,		"r#   c                 >    [        U5      nU R                  U5        U$ )a6  Add a new wheel input device to the action builder.

Parameters:
-----------
name : str
    The name of the wheel input device.

Returns:
--------
WheelInput : The newly created wheel input device.

Example:
--------
>>> action_builder = ActionBuilder(driver)
>>> action_builder.add_wheel_input(name="wheel2")
)r   rE   rF   s      r    add_wheel_inputActionBuilder.add_wheel_input   s     " t$		"r#   c                     S/ 0nU R                    H:  nUR                  5       nUS   (       d  M  US   R                  U5        / Ul        M<     U R                  R                  [        R                  U5        g)a  Performs all stored actions.

Example:
--------
>>> action_builder = ActionBuilder(driver)
>>> keyboard = action_builder.key_input
>>> el = driver.find_element(id: "some_id")
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys("keys").perform()
actionsN)r   encodeappendrR   r   executer   W3C_ACTIONS)r   encr3   encodeds       r    performActionBuilder.perform   sf     &/OllFmmoGy!!I%%g.!#	 #
 	G//5r#   c                 V    U R                   R                  [        R                  5        g)aQ  Clears actions that are already stored on the remote end.

Example:
--------
>>> action_builder = ActionBuilder(driver)
>>> keyboard = action_builder.key_input
>>> el = driver.find_element(By.ID, "some_id")
>>> action_builder.click(el).pause(keyboard).pause(keyboard).pause(keyboard).send_keys("keys")
>>> action_builder.clear_actions()
N)r   rU   r   W3C_CLEAR_ACTIONSr;   s    r    clear_actionsActionBuilder.clear_actions   s     	G556r#   rG   c                 :    U R                   R                  U5        g)zAdd a new input device to the action builder.

Parameters:
-----------
new_input : Union[KeyInput, PointerInput, WheelInput]
    The new input device to add.
N)r   rT   )r   rG   s     r    rE   ActionBuilder._add_input   s     	I&r#   )r   r   r   r   r   )NNN   )r   N)__name__
__module____qualname____firstlineno__r   r
   r   r   intr!   strr   r.   propertylistr4   r8   r   r<   r	   r?   r   rB   rH   rL   rO   rY   r]   rE   __static_attributes__r(   r#   r    r   r      sw    )-&*'+ % 
#	
 8$  
"EC EHU;c5d,e E W\ 2 W W SDN S S  J     $ $ $ "l " "# ( *c   6C J *6$7'E(L**L$M 'RV 'r#   r   N)typingr   r   r   !selenium.webdriver.common.actionsr   -selenium.webdriver.common.actions.key_actionsr   +selenium.webdriver.common.actions.key_inputr   1selenium.webdriver.common.actions.pointer_actionsr	   /selenium.webdriver.common.actions.pointer_inputr
   /selenium.webdriver.common.actions.wheel_actionsr   -selenium.webdriver.common.actions.wheel_inputr   !selenium.webdriver.remote.commandr   r   r(   r#   r    <module>rt      s1   & ( ' 9 D @ L H H D 5`' `'r#   