The Touchscreen class operates in main-frame CSS pixels relative to the top-left corner of the viewport. Methods on the
touchscreen can only be used in browser contexts that have been initialized with :has_touch set to true.
This class is limited to emulating tap gestures. For examples of other gestures simulated by manually dispatching touch events, see the emulating legacy touch events page.
Since Playwright 1.8.
The examples alias the modules they use (alias Playwright.{Locator, Page}).
Summary
Types
@type t() :: %Playwright.Touchscreen{_page: term()}
A Touchscreen handle. Compare handles with ==, their fields are internal.
Functions
@spec tap(t(), number(), number()) :: :ok | {:error, Playwright.error()}
Dispatches a touchstart and touchend event with a single touch at the position (x,y).
Note
Playwright.Touchscreen.tap/3 will fail if the :has_touch option of the browser context is false.
Since Playwright 1.8.
Arguments
x- X coordinate relative to the main frame's viewport in CSS pixels.y- Y coordinate relative to the main frame's viewport in CSS pixels.
Like tap/3, but returns the value and raises on error.