I'm trying to test a Mobile Website with Selenium and nodeJS.
Thats way I'm trying to simulate user interaction with a touch and/or swipe, but I could find any solution, that work with my Application.
I found this two SO Post that kind of ask the same:
How do I programmatically create a TouchEvent in Chrome 41? and WebDriver simulate touch events in Desktop Browser
But both generate TouchEvents, that are not trusted (so recognizable as no real human interaction). And this is not useful since the Application tests if the Events (TouchEvent) are trusted. MDN Link to isTrusted
I couldn't find anything about creating/simulating TouchEvents in the online Documentation of selenium-webdriver, and faking touchEvents with driver.executeScript
as mentioned above creates untrusted Events. (what is clear because if not, any Website could fake user interaction)
And the application tests (apart of some other things), for
document.body.addEventListener("touchstart", e => {
evt.preventDefault();
...
if (e.isTrusted) {
/* The event is trusted do STUFF */
...
}
});
My main Question is, can selenium create trusted (Touch) Events, with on Chrome(Main Browser we use for testing) with nodeJs(or any other language if it needs to)?
Alternative: Is the a workaround, that doesn't involve changing the application Code? I would even consider using a different modern browser, that plays well with selenium.