
    hg\                     2    d Z ddlmZ  G d de          ZdS )z"
The Touch Actions implementation
    )Commandc                   f    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 ZdS )TouchActionsz
    Generate touch actions. Works like ActionChains; actions are stored in the
    TouchActions object and are fired with perform().
    c                 "    || _         g | _        dS )z
        Creates a new TouchActions object.

        :Args:
         - driver: The WebDriver instance which performs user actions.
           It should be with touchscreen enabled.
        N)_driver_actions)selfdrivers     `/var/www/fb-scrape/myenv/lib/python3.11/site-packages/selenium/webdriver/common/touch_actions.py__init__zTouchActions.__init__   s         c                 .    | j         D ]} |             dS )z.
        Performs all stored actions.
        N)r   )r	   actions     r   performzTouchActions.perform*   s,     m 	 	FFHHHH	 	r   c                 F      j                              fd            S )ze
        Taps on a given element.

        :Args:
         - on_element: The element to tap.
        c                  \    j                             t          j        d j        i          S Nelement)r   executer   
SINGLE_TAPid
on_elementr	   s   r   <lambda>z"TouchActions.tap.<locals>.<lambda>8   (    T\%9%9JM :&< &< r   r   appendr	   r   s   ``r   tapzTouchActions.tap1   >     	 < < < < < 	= 	= 	=r   c                 F      j                              fd            S )zl
        Double taps on a given element.

        :Args:
         - on_element: The element to tap.
        c                  \    j                             t          j        d j        i          S r   )r   r   r   
DOUBLE_TAPr   r   s   r   r   z)TouchActions.double_tap.<locals>.<lambda>C   r   r   r   r   s   ``r   
double_tapzTouchActions.double_tap<   r    r   c                 J      j                              fd            S )z
        Touch down at given coordinates.

        :Args:
         - xcoord: X Coordinate to touch down.
         - ycoord: Y Coordinate to touch down.
        c                       j                             t          j        t	                    t	                    d          S N)xy)r   r   r   
TOUCH_DOWNintr	   xcoordycoords   r   r   z+TouchActions.tap_and_hold.<locals>.<lambda>O   ;    T\%9%9[[[[!" !"&# &# r   r   r,   s   ```r   tap_and_holdzTouchActions.tap_and_holdG   F     	 # # # # # # 	$ 	$ 	$ r   c                 J      j                              fd            S )z
        Move held tap to specified location.

        :Args:
         - xcoord: X Coordinate to move.
         - ycoord: Y Coordinate to move.
        c                       j                             t          j        t	                    t	                    d          S r'   )r   r   r   
TOUCH_MOVEr+   r,   s   r   r   z#TouchActions.move.<locals>.<lambda>]   r/   r   r   r,   s   ```r   movezTouchActions.moveU   r1   r   c                 J      j                              fd            S )z
        Release previously issued tap 'and hold' command at specified location.

        :Args:
         - xcoord: X Coordinate to release.
         - ycoord: Y Coordinate to release.
        c                       j                             t          j        t	                    t	                    d          S r'   )r   r   r   TOUCH_UPr+   r,   s   r   r   z&TouchActions.release.<locals>.<lambda>k   s;    T\%9%9[[[[" "&# &# r   r   r,   s   ```r   releasezTouchActions.releasec   r1   r   c                 J      j                              fd            S )z
        Touch and scroll, moving by xoffset and yoffset.

        :Args:
         - xoffset: X offset to scroll to.
         - yoffset: Y offset to scroll to.
        c                       j                             t          j        t	                    t	                    d          S )N)xoffsetyoffset)r   r   r   TOUCH_SCROLLr+   r	   r<   r=   s   r   r   z%TouchActions.scroll.<locals>.<lambda>y   s;    T\%9%9 w<<w<<#) #)&* &* r   r   r?   s   ```r   scrollzTouchActions.scrollq   sF     	 * * * * * * 	+ 	+ 	+ r   c                 N      j                              fd            S )z
        Touch and scroll starting at on_element, moving by xoffset and yoffset.

        :Args:
         - on_element: The element where scroll starts.
         - xoffset: X offset to scroll to.
         - yoffset: Y offset to scroll to.
        c                      j                             t          j         j        t                    t                    d          S )N)r   r<   r=   )r   r   r   r>   r   r+   )r   r	   r<   r=   s   r   r   z2TouchActions.scroll_from_element.<locals>.<lambda>   s@    T\%9%9 %=w<<w<<#) #)&* &* r   r   )r	   r   r<   r=   s   ````r   scroll_from_elementz TouchActions.scroll_from_element   sL     	 * * * * * * * 	+ 	+ 	+
 r   c                 F      j                              fd            S )zm
        Long press on an element.

        :Args:
         - on_element: The element to long press.
        c                  \    j                             t          j        d j        i          S r   )r   r   r   
LONG_PRESSr   r   s   r   r   z)TouchActions.long_press.<locals>.<lambda>   r   r   r   r   s   ``r   
long_presszTouchActions.long_press   r    r   c                 J      j                              fd            S )z
        Flicks, starting anywhere on the screen.

        :Args:
         - xspeed: The X speed in pixels per second.
         - yspeed: The Y speed in pixels per second.
        c                       j                             t          j        t	                    t	                    d          S )N)xspeedyspeed)r   r   r   FLICKr+   r	   rJ   rK   s   r   r   z$TouchActions.flick.<locals>.<lambda>   s:    T\%9%9Mf++f++' '&( &( r   r   rM   s   ```r   flickzTouchActions.flick   sF     	 ( ( ( ( ( ( 	) 	) 	) r   c                 R      j                              fd            S )aC  
        Flick starting at on_element, and moving by the xoffset and yoffset
        with specified speed.

        :Args:
         - on_element: Flick will start at center of element.
         - xoffset: X offset to flick to.
         - yoffset: Y offset to flick to.
         - speed: Pixels per second to flick.
        c            	          j                             t          j         j        t                    t                    t                    d          S )N)r   r<   r=   speed)r   r   r   rL   r   r+   )r   r	   rQ   r<   r=   s   r   r   z,TouchActions.flick_element.<locals>.<lambda>   sH    T\%9%9M%=w<<w<<U	% %&& && r   r   )r	   r   r<   r=   rQ   s   `````r   flick_elementzTouchActions.flick_element   sR     	 & & & & & & & & 	' 	' 	' r   c                     | S N )r	   s    r   	__enter__zTouchActions.__enter__   s    r   c                     d S rT   rU   )r	   _type_value
_tracebacks       r   __exit__zTouchActions.__exit__   s    r   N)__name__
__module____qualname____doc__r   r   r   r$   r0   r5   r9   r@   rC   rG   rN   rR   rV   r[   rU   r   r   r   r      s         
	 	 	  	 	 		 	 	           	 	 	    (      r   r   N)r_   !selenium.webdriver.remote.commandr   objectr   rU   r   r   <module>rb      sa   $  6 5 5 5 5 5g g g g g6 g g g g gr   