playwright
playwright copied to clipboard
[Feature] Support for touch events/gestures
Web apps running on touch devices (e.g, mobile and Surface) rely on touch gestures like swiping and pinching to zoom. While page.dispatchEvent can manufacture synthetic touch points, having a simpler API would improve the dev experience.
Scenarios
- Two-finger pinch to zoom in/out on a particular element (e.g., canvas in Azure ML designer)
- Verify that two-finger left/right swipe is not leading to go back/forward
It would also be interesting a feature to tap on certain elements or coordinates as Puppeteer allowed.
Simple code as:
await page.tap('div.example)
await element.tap()
+swipe
+for swipe
+1 swipe
is there some quick-access to achieve touch move in mobile, etc popup picker
Having the ability to swipe, dragto, or even replicate the mouse class for touchscreen would be great. If I could use the touchscreen class to move, press down, move, and unpress, it would take care of a lot of issues that I'm currently having with dragging elements.
I found this issue because I wanted to be able to drag an element using touch events as described in https://github.com/microsoft/playwright/issues/12599. It looks like I might be able to dispatch the events (see https://github.com/microsoft/playwright/issues/6072) but it'd be nice to just say "dragto" and have it do the proper touchstart, touchmove and touchend behaviors for me.
+1 for swipe action
+1 for overall possibility to automate touch
+1 for overall possibility to automate touch
+1 for native mobile gestures like swipe
Is this experimental API (https://playwright.dev/docs/api/class-androidinput) an attempt to implement this feature? I didn't test it yet.
+swipe
Tried a workaround with Touchevent, but I'm getting two touch points on the start and the end coordinates. Probably I messed up something.
await page.evaluate(
([startX, startY, endX, endY]) => {
const touchStartEvent = new TouchEvent("touchstart", {
bubbles: true,
cancelable: true,
composed: true,
touches: [new Touch({ identifier: 1, target: document.documentElement, clientX: startX, clientY: startY })],
});
document.elementFromPoint(startX, startY).dispatchEvent(touchStartEvent);
const touchMoveEvent = new TouchEvent("touchmove", {
bubbles: true,
cancelable: true,
composed: true,
touches: [
new Touch({ identifier: 1, target: document.documentElement, clientX: startX, clientY: startY }),
new Touch({ identifier: 2, target: document.documentElement, clientX: endX, clientY: endY }),
],
});
document.elementFromPoint(startX, startY).dispatchEvent(touchMoveEvent);
const touchEndEvent = new TouchEvent("touchend", {
bubbles: true,
cancelable: true,
composed: true,
touches: [],
});
document.elementFromPoint(startX, startY).dispatchEvent(touchEndEvent);
},
[startX, startY, endX, endY]
);
+1 for swipe / dragTo / touch move 🙏
+1 for swipe / dragTo / touch move
+1 for swipe / dragTo / touch move
+1 for swipe, pinch and dragTo.
+1 for swipe
+1 for swipe
+1 for multi touch / simulating touch events
+1 for simulating long press on mobile device
damn this is really needed. Please implement this :)
+1 for swipe/touch events please :)
+1 for swipe
+1 for swipe
+1 for swipe
+1 for all mobile gestures
+1 swipe!
playwright devs lazy as fuk, still not added after 3 years
+1