feat(driver): add Driver.double_tap via W3C actions
This commit is contained in:
@@ -98,6 +98,15 @@ class AndroidDriver(Driver):
|
||||
except Exception as exc:
|
||||
raise DriverError("long press failed") from exc
|
||||
|
||||
def double_tap(self, x: float, y: float, interval_ms: int = 80) -> None:
|
||||
from driver._w3c_actions import build_double_tap_actions, perform_actions
|
||||
|
||||
client = self._require_client()
|
||||
try:
|
||||
perform_actions(client, build_double_tap_actions(x, y, interval_ms))
|
||||
except Exception as exc:
|
||||
raise DriverError("double tap failed") from exc
|
||||
|
||||
def swipe(
|
||||
self,
|
||||
start_x: float,
|
||||
|
||||
@@ -51,6 +51,10 @@ class Driver(ABC):
|
||||
) -> None:
|
||||
"""Swipe through a sequence of waypoints in one continuous touch."""
|
||||
|
||||
@abstractmethod
|
||||
def double_tap(self, x: float, y: float, interval_ms: int = 80) -> None:
|
||||
"""Tap twice at the given coordinates with ``interval_ms`` between."""
|
||||
|
||||
@abstractmethod
|
||||
def input(self, text: str) -> None:
|
||||
"""Input text into the current focused field."""
|
||||
|
||||
@@ -90,6 +90,15 @@ class WDADriver(Driver):
|
||||
except Exception as exc:
|
||||
raise DriverError("long press failed") from exc
|
||||
|
||||
def double_tap(self, x: float, y: float, interval_ms: int = 80) -> None:
|
||||
from driver._w3c_actions import build_double_tap_actions, perform_actions
|
||||
|
||||
client = self._require_client()
|
||||
try:
|
||||
perform_actions(client, build_double_tap_actions(x, y, interval_ms))
|
||||
except Exception as exc:
|
||||
raise DriverError("double tap failed") from exc
|
||||
|
||||
def swipe(
|
||||
self,
|
||||
start_x: float,
|
||||
|
||||
Reference in New Issue
Block a user