# `Playwright.Touchscreen`
[🔗](https://github.com/ftes/playwright_ex/blob/v1.65.0-rc.3/lib/playwright/api/touchscreen.ex#L7)

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](https://playwright.dev/docs/touch-events) page.

*Since Playwright 1.8.*

The examples alias the modules they use (`alias Playwright.{Locator, Page}`).

# `t`

```elixir
@type t() :: %Playwright.Touchscreen{_page: term()}
```

A `Touchscreen` handle. Compare handles with `==`, their fields are internal.

# `tap`

```elixir
@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 {: .info}
>
> `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.

# `tap!`

```elixir
@spec tap!(t(), number(), number()) :: :ok
```

Like `tap/3`, but returns the value and raises on error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
