Long press at the specified coordinates. Args: x: X coordinate. y: Y coordinate. duration_ms: Duration of press in milliseconds (note: HarmonyOS longClick may not support duration). device_id: Optional HDC device ID. delay: Delay in seconds after lon
(
x: int,
y: int,
duration_ms: int = 3000,
device_id: str | None = None,
delay: float | None = None,
)
| 128 | |
| 129 | |
| 130 | def long_press( |
| 131 | x: int, |
| 132 | y: int, |
| 133 | duration_ms: int = 3000, |
| 134 | device_id: str | None = None, |
| 135 | delay: float | None = None, |
| 136 | ) -> None: |
| 137 | """ |
| 138 | Long press at the specified coordinates. |
| 139 | |
| 140 | Args: |
| 141 | x: X coordinate. |
| 142 | y: Y coordinate. |
| 143 | duration_ms: Duration of press in milliseconds (note: HarmonyOS longClick may not support duration). |
| 144 | device_id: Optional HDC device ID. |
| 145 | delay: Delay in seconds after long press. If None, uses configured default. |
| 146 | """ |
| 147 | if delay is None: |
| 148 | delay = TIMING_CONFIG.device.default_long_press_delay |
| 149 | |
| 150 | hdc_prefix = _get_hdc_prefix(device_id) |
| 151 | |
| 152 | # HarmonyOS uses uitest uiInput longClick |
| 153 | # Note: longClick may have a fixed duration, duration_ms parameter might not be supported |
| 154 | _run_hdc_command( |
| 155 | hdc_prefix + ["shell", "uitest", "uiInput", "longClick", str(x), str(y)], |
| 156 | capture_output=True, |
| 157 | ) |
| 158 | time.sleep(delay) |
| 159 | |
| 160 | |
| 161 | def swipe( |
nothing calls this directly
no test coverage detected