WebDriver simulate touch events in Desktop Browser

前端 未结 2 1594
耶瑟儿~
耶瑟儿~ 2021-01-14 19:36

I\'m trying to simulate some touch events like swap, tap in web-based application using Chrome and Firefox browsers. I\'ve tried to simulate touch events with Actions, Hummb

相关标签:
2条回答
  • 2021-01-14 19:54

    With jQueryMobile it is quite simple, I execute some Javascript which trigger the corresponding touch events from jQueryMobile.

    ((JavascriptExecutor)driver).executeScript("window.jQuery('#myId').trigger('swiperight')");
    

    Maybe that helps.

    0 讨论(0)
  • 2021-01-14 20:19

    I'm using phantom limb which transforms mouse events to touch events. It worked for me. I thing the best way to simulate touch events in Chrome is to use built-in emulations mechanism. Like in this article. Unfortunately I can't find the way to turn on this feature by webdriver. Found the Chrome options like "enable-touch-events", "touch-events" and etc. But it didn't worked.

    UP: Chrome Driver allows to emulate chrome browser on mobile device. Read this article.

    0 讨论(0)
提交回复
热议问题