Skip to content

The ActionHelpers.tap function pause 100 seconds if no duration provided #672

@ice7mayu

Description

@ice7mayu

The problem

When calling driver.tap() function without duration, the default w3c actions paused 100 seconds.
According to the function doc the duration unit should be ms.

See the FIXME tag in the source code below.

Environment

  • Appium version (or git revision) that exhibits the issue: 2.1.1

Details

source code: appium/webdriver/extensions/action_helpers.py at line 120

class ActionHelpers(webdriver.Remote):
    def tap(self: T, positions: List[Tuple[int, int]], duration: Optional[int] = None) -> T:
        """Taps on an particular place with up to five fingers, holding for a
            certain time
    
            Args:
                positions: an array of tuples representing the x/y coordinates of
                    the fingers to tap. Length can be up to five.
                duration: length of time to tap, in ms
    
            Usage:
                driver.tap([(100, 20), (100, 60), (100, 100)], 500)
    
            Returns:
                Union['WebDriver', 'ActionHelpers']: Self instance
        """
        if len(positions) == 1:
            actions = ActionChains(self)
            actions.w3c_actions = ActionBuilder(self, mouse=PointerInput(interaction.POINTER_TOUCH, "touch"))
            x = positions[0][0]
            y = positions[0][1]
            actions.w3c_actions.pointer_action.move_to_location(x, y)
            actions.w3c_actions.pointer_action.pointer_down()
            if duration:
                actions.w3c_actions.pointer_action.pause(duration / 1000)
            else:
                # FIXME: I think the default pause time should be 0.1 seconds or (100/1000)
                actions.w3c_actions.pointer_action.pause(100)  
            actions.w3c_actions.pointer_action.release()
            actions.perform()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions